From e548206c18b9d109ab8cbd8d89567168637fe5c0 Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Sun, 1 Mar 2009 11:40:49 +0000 Subject: [PATCH] =?UTF-8?q?Den=20Entityhandler=20=C3=BCberarbeitet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/cl_ents.c | 22 +-- src/client/cl_fx.c | 332 ++++++++++++++++++++++++------------------- src/client/client.h | 2 +- 3 files changed, 193 insertions(+), 163 deletions(-) diff --git a/src/client/cl_ents.c b/src/client/cl_ents.c index 0ce4c76e..54ef7f49 100644 --- a/src/client/cl_ents.c +++ b/src/client/cl_ents.c @@ -132,16 +132,6 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int number, int bi else if (bits & U_RENDERFX16) 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) to->origin[0] = MSG_ReadCoord (&net_message); if (bits & U_ORIGIN2) @@ -871,11 +861,11 @@ void CL_AddPacketEntities (frame_t *frame) // FIXME: still pass to refresh 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) - 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 - 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 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; CL_TrapParticles (&ent); 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) { @@ -1112,7 +1102,7 @@ void CL_AddPacketEntities (frame_t *frame) if(vidref_val == VIDREF_GL) V_AddLight (ent.origin, intensity, -1.0, -1.0, -1.0); 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 { @@ -1164,7 +1154,7 @@ CL_AddViewWeapon */ 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; // allow the gun to be completely removed diff --git a/src/client/cl_fx.c b/src/client/cl_fx.c index 53932321..deba4927 100644 --- a/src/client/cl_fx.c +++ b/src/client/cl_fx.c @@ -101,10 +101,7 @@ void CL_SetLightstyle (int i) s = cl.configstrings[i+CS_LIGHTS]; - j = strlen (s); - if (j >= MAX_QPATH) - Com_Error (ERR_DROP, "svc_lightstyle length=%i", j); - + j = (int)strlen (s); cl_lightstyle[i].length = j; for (k=0 ; kkey == key) { - memset (dl, 0, sizeof(*dl)); dl->key = key; return dl; } @@ -177,14 +173,12 @@ cdlight_t *CL_AllocDlight (int key) { if (dl->die < cl.time) { - memset (dl, 0, sizeof(*dl)); dl->key = key; return dl; } } dl = &cl_dlights[0]; - memset (dl, 0, sizeof(*dl)); dl->key = key; return dl; } @@ -266,14 +260,14 @@ void CL_ParseMuzzleFlash (void) VectorMA (dl->origin, 18, fv, dl->origin); VectorMA (dl->origin, 16, rv, dl->origin); if (silenced) - dl->radius = 100 + (rand()&31); + dl->radius = 100.0f + (rand()&31); else - dl->radius = 200 + (rand()&31); + dl->radius = 200.0f + (rand()&31); dl->minlight = 32; dl->die = cl.time; // + 0.1; if (silenced) - volume = 0.2; + volume = 0.2f; else volume = 1; @@ -293,43 +287,43 @@ void CL_ParseMuzzleFlash (void) break; case MZ_MACHINEGUN: 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); break; case MZ_SHOTGUN: 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_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; case MZ_SSHOTGUN: 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); break; 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; - 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); break; 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->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); - 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); break; 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->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); - Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.033); - Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); - S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.066); + 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.033f); + 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.066f); break; case MZ_RAILGUN: 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: 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_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; case MZ_GRENADE: 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_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; case MZ_BFG: dl->color[0] = 0;dl->color[1] = 1;dl->color[2] = 0; @@ -352,13 +346,13 @@ void CL_ParseMuzzleFlash (void) case MZ_LOGIN: 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); CL_LogoutEffect (pl->current.origin, weapon); break; case MZ_LOGOUT: 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); CL_LogoutEffect (pl->current.origin, weapon); break; @@ -382,7 +376,7 @@ void CL_ParseMuzzleFlash (void) // ====================== // PGM 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); break; case MZ_SHOTGUN2: @@ -434,7 +428,7 @@ void CL_ParseMuzzleFlash2 (void) { int ent; vec3_t origin; - int flash_number; + unsigned flash_number; cdlight_t *dl; vec3_t forward, right; char soundname[64]; @@ -445,6 +439,9 @@ void CL_ParseMuzzleFlash2 (void) flash_number = MSG_ReadByte (&net_message); + if (flash_number > 210) + Com_Error (ERR_DROP, "CL_ParseMuzzleFlash2: bad offset"); + // locate the origin 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]; @@ -453,7 +450,7 @@ void CL_ParseMuzzleFlash2 (void) dl = CL_AllocDlight (ent); VectorCopy (origin, dl->origin); - dl->radius = 200 + (rand()&31); + dl->radius = 200.0f + (rand()&31); dl->minlight = 32; 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; CL_ParticleEffect (origin, vec3_origin, 0, 40); 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); break; case MZ2_CHICK_ROCKET_1: 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); break; case MZ2_TANK_ROCKET_1: case MZ2_TANK_ROCKET_2: 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); break; @@ -636,7 +633,7 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_BOSS2_ROCKET_3: case MZ2_BOSS2_ROCKET_4: 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); break; @@ -790,7 +787,7 @@ void CL_ParseMuzzleFlash2 (void) case MZ2_WIDOW2_BEAM_SWEEP_9: case MZ2_WIDOW2_BEAM_SWEEP_10: 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->die = cl.time + 200; break; @@ -823,6 +820,7 @@ void CL_AddDLights (void) { if (!dl->radius) continue; + V_AddLight (dl->origin, dl->radius, dl->color[0], dl->color[1], dl->color[2]); } @@ -842,6 +840,7 @@ void CL_AddDLights (void) dl->color[1] = 1; dl->color[2] = 1; } + V_AddLight (dl->origin, dl->radius, 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[2] = -PARTICLE_GRAVITY; + p->accel[2] = -PARTICLE_GRAVITY+0.2f; p->alpha = 1.0; 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; cparticle_t *p; float d; + float time; + time = (float)cl.time; for (i=0 ; inext = active_particles; active_particles = p; - p->time = cl.time; - p->color = color; + p->time = time; + p->color = color + (rand()&7); d = rand()&7; 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->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; cparticle_t *p; float d; + float time; + time = (float)cl.time; for (i=0 ; inext = active_particles; active_particles = p; - p->time = cl.time; + p->time = time; p->color = color; 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->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; cparticle_t *p; + float time; + time = (float)cl.time; for (i=0 ; i<8 ; i++) { @@ -1013,7 +1018,7 @@ void CL_TeleporterParticles (entity_state_t *ent) p->next = active_particles; active_particles = p; - p->time = cl.time; + p->time = time; p->color = 0xdb; for (j=0 ; j<2 ; j++) @@ -1044,6 +1049,8 @@ void CL_LogoutEffect (vec3_t org, int type) { int i, j; cparticle_t *p; + float time; + time = (float)cl.time; for (i=0 ; i<500 ; i++) { @@ -1054,7 +1061,7 @@ void CL_LogoutEffect (vec3_t org, int type) p->next = active_particles; active_particles = p; - p->time = cl.time; + p->time = time; if (type == MZ_LOGIN) p->color = 0xd0 + (rand()&7); // green @@ -1089,6 +1096,8 @@ void CL_ItemRespawnParticles (vec3_t org) { int i, j; cparticle_t *p; + float time; + time = (float)cl.time; for (i=0 ; i<64 ; i++) { @@ -1099,7 +1108,7 @@ void CL_ItemRespawnParticles (vec3_t org) p->next = active_particles; active_particles = p; - p->time = cl.time; + p->time = time; p->color = 0xd4 + (rand()&3); // green p->org[0] = org[0] + 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->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; cparticle_t *p; + float time; + time = (float)cl.time; for (i=0 ; i<256 ; i++) { @@ -1136,7 +1147,7 @@ void CL_ExplosionParticles (vec3_t org) p->next = active_particles; active_particles = p; - p->time = cl.time; + p->time = time; p->color = 0xe0 + (rand()&7); for (j=0 ; j<3 ; j++) { @@ -1148,7 +1159,7 @@ void CL_ExplosionParticles (vec3_t org) p->accel[2] = -PARTICLE_GRAVITY; 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; cparticle_t *p; + float time; + time = (float)cl.time; float angle, dist; 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; active_particles = p; - p->time = cl.time; + p->time = time; 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; - p->vel[1] = sin(angle)*(70+(rand()&63)); - p->accel[1] = -sin(angle)*100; + angle = M_PI*2*(rand()&1023)/1023.0f; + dist = (float)(rand()&31); + 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->vel[2] = -100 + (rand()&31); p->accel[2] = PARTICLE_GRAVITY*4; 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; float d; int count; + float time; + time = (float)cl.time; count = 40; for (i=0 ; inext = active_particles; active_particles = p; - p->time = cl.time; + p->time = time; p->color = 0xe0 + (rand()&7); d = rand()&15; 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->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 vec; - float len; + int len; int j; cparticle_t *p; int dec; + float time; + time = (float)cl.time; VectorCopy (start, move); VectorSubtract (end, start, vec); - len = VectorNormalize (vec); + len = (int)VectorNormalize (vec); dec = 5; VectorScale (vec, 5, vec); @@ -1272,10 +1290,10 @@ void CL_BlasterTrail (vec3_t start, vec3_t end) active_particles = p; VectorClear (p->accel); - p->time = cl.time; + p->time = time; 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; for (j=0 ; j<3 ; j++) { @@ -1298,14 +1316,16 @@ void CL_QuadTrail (vec3_t start, vec3_t end) { vec3_t move; vec3_t vec; - float len; + int len; int j; cparticle_t *p; int dec; + float time; + time = (float)cl.time; VectorCopy (start, move); VectorSubtract (end, start, vec); - len = VectorNormalize (vec); + len = (int)VectorNormalize (vec); dec = 5; VectorScale (vec, 5, vec); @@ -1322,10 +1342,10 @@ void CL_QuadTrail (vec3_t start, vec3_t end) active_particles = p; VectorClear (p->accel); - p->time = cl.time; + p->time = time; 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; 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 vec; - float len; + int len; int j; cparticle_t *p; int dec; + float time; + time = (float)cl.time; VectorCopy (start, move); VectorSubtract (end, start, vec); - len = VectorNormalize (vec); + len = (int)VectorNormalize (vec); dec = 5; VectorScale (vec, 5, vec); @@ -1372,10 +1394,10 @@ void CL_FlagTrail (vec3_t start, vec3_t end, boolean isred) active_particles = p; VectorClear (p->accel); - p->time = cl.time; + p->time = time; 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; 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 vec; - float len; + int len; int j; cparticle_t *p; float dec; float orgscale; float velscale; + float time; + time = (float)cl.time; VectorCopy (start, move); 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; VectorClear (p->accel); - p->time = cl.time; + p->time = time; if (flags & EF_GIB) { 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); 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) { 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); 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 { 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); 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 vec; - float len; + int len; int j; cparticle_t *p; - float dec; + int dec; + float time; + time = (float)cl.time; // smoke CL_DiminishingTrail (start, end, old, EF_ROCKET); @@ -1530,7 +1556,7 @@ void CL_RocketTrail (vec3_t start, vec3_t end, centity_t *old) // fire VectorCopy (start, move); VectorSubtract (end, start, vec); - len = VectorNormalize (vec); + len = (int)VectorNormalize (vec); dec = 1; VectorScale (vec, dec, vec); @@ -1550,10 +1576,10 @@ void CL_RocketTrail (vec3_t start, vec3_t end, centity_t *old) active_particles = p; VectorClear (p->accel); - p->time = cl.time; + p->time = time; 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); for (j=0 ; j<3 ; j++) { @@ -1576,7 +1602,7 @@ void CL_RailTrail (vec3_t start, vec3_t end) { vec3_t move; vec3_t vec; - float len; + int len; int j; cparticle_t *p; float dec; @@ -1585,6 +1611,8 @@ void CL_RailTrail (vec3_t start, vec3_t end) float d, c, s; vec3_t dir; byte clr = 0x74; + float time; + time = (float)cl.time; VectorCopy (start, move); VectorSubtract (end, start, vec); @@ -1602,18 +1630,18 @@ void CL_RailTrail (vec3_t start, vec3_t end) p->next = active_particles; active_particles = p; - p->time = cl.time; + p->time = time; VectorClear (p->accel); - d = i * 0.1; - c = cos(d); - s = sin(d); + d = i * 0.1f; + c = (float)cos(d); + s = (float)sin(d); VectorScale (right, c, dir); VectorMA (dir, s, up, dir); 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); for (j=0 ; j<3 ; j++) { @@ -1639,11 +1667,11 @@ void CL_RailTrail (vec3_t start, vec3_t end) p->next = active_particles; active_particles = p; - p->time = cl.time; + p->time = time; VectorClear (p->accel); 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); for (j=0 ; j<3 ; j++) { @@ -1666,15 +1694,17 @@ void CL_IonripperTrail (vec3_t start, vec3_t ent) { vec3_t move; vec3_t vec; - float len; + int len; int j; cparticle_t *p; int dec; int left = 0; + float time; + time = (float)cl.time; VectorCopy (start, move); VectorSubtract (ent, start, vec); - len = VectorNormalize (vec); + len = (int)VectorNormalize (vec); dec = 5; VectorScale (vec, 5, vec); @@ -1691,9 +1721,9 @@ void CL_IonripperTrail (vec3_t start, vec3_t ent) active_particles = p; VectorClear (p->accel); - p->time = cl.time; + p->time = time; 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); for (j=0; j<3; j++) { @@ -1729,10 +1759,12 @@ void CL_BubbleTrail (vec3_t start, vec3_t end) { vec3_t move; vec3_t vec; - float len; + int len; int i, j; cparticle_t *p; float dec; + float time; + time = (float)cl.time; VectorCopy (start, move); VectorSubtract (end, start, vec); @@ -1741,7 +1773,7 @@ void CL_BubbleTrail (vec3_t start, vec3_t end) dec = 32; VectorScale (vec, dec, vec); - for (i=0 ; iaccel); - p->time = cl.time; + p->time = time; 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); for (j=0 ; j<3 ; j++) { @@ -1781,11 +1813,13 @@ void CL_FlyParticles (vec3_t origin, int count) int i; cparticle_t *p; float angle; - float sr, sp, sy, cr, cp, cy; + float sp, sy, cp, cy; vec3_t forward; float dist = 64; float ltime; + float time; + time = (float)cl.time; if (count > NUMVERTEXNORMALS) count = NUMVERTEXNORMALS; @@ -1793,22 +1827,20 @@ void CL_FlyParticles (vec3_t origin, int count) if (!avelocities[0][0]) { for (i=0 ; inext = active_particles; 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[1] = origin[1] + bytedirs[i][1]*dist + forward[1]*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; if (n < 20000) - count = n * 162 / 20000.0; + count = (int)n * 162 / 20000.0; else { n = ent->fly_stoptime - cl.time; if (n < 20000) - count = n * 162 / 20000.0; + count = (int)n * 162 / 20000.0; else count = 162; } @@ -1882,31 +1914,32 @@ void CL_BfgParticles (entity_t *ent) int i; cparticle_t *p; float angle; - float sr, sp, sy, cr, cp, cy; + float sp, sy, cp, cy; vec3_t forward; float dist = 64; vec3_t v; float ltime; + float time; + + time = (float)cl.time; if (!avelocities[0][0]) { for (i=0 ; inext = active_particles; 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[1] = ent->origin[1] + bytedirs[i][1]*dist + forward[1]*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); VectorSubtract (p->org, ent->origin, v); - dist = VectorLength(v) / 90.0; - p->color = floor (0xd0 + dist * 7); + dist = VectorLength(v) / 90.0f; + p->color = (int)floor (0xd0 + dist * 7); p->colorvel = 0; - p->alpha = 1.0 - dist; + p->alpha = 1.0f - dist; p->alphavel = -100; } } @@ -1950,10 +1983,13 @@ void CL_TrapParticles (entity_t *ent) vec3_t move; vec3_t vec; vec3_t start, end; - float len; + int len; int j; cparticle_t *p; int dec; + float time; + + time = (float)cl.time; ent->origin[2]-=14; VectorCopy (ent->origin, start); @@ -1962,7 +1998,7 @@ void CL_TrapParticles (entity_t *ent) VectorCopy (start, move); VectorSubtract (end, start, vec); - len = VectorNormalize (vec); + len = (int)VectorNormalize (vec); dec = 5; VectorScale (vec, 5, vec); @@ -1980,10 +2016,10 @@ void CL_TrapParticles (entity_t *ent) active_particles = p; VectorClear (p->accel); - p->time = cl.time; + p->time = time; 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; for (j=0 ; j<3 ; j++) { @@ -2021,21 +2057,21 @@ void CL_TrapParticles (entity_t *ent) p->next = active_particles; active_particles = p; - p->time = cl.time; + p->time = time; p->color = 0xe0 + (rand()&3); 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[1] = org[1] + j + ((rand()&23) * crand()); p->org[2] = org[2] + k + ((rand()&23) * crand()); - dir[0] = j * 8; - dir[1] = i * 8; - dir[2] = k * 8; + dir[0] = j * 8.0f; + dir[1] = i * 8.0f; + dir[2] = k * 8.0f; VectorNormalize (dir); - vel = 50 + (rand()&63); + vel = (float)(50 + (rand()&63)); VectorScale (dir, vel, p->vel); p->accel[0] = p->accel[1] = 0; @@ -2055,6 +2091,8 @@ void CL_BFGExplosionParticles (vec3_t org) { int i, j; cparticle_t *p; + float time; + time = (float)cl.time; for (i=0 ; i<256 ; i++) { @@ -2065,7 +2103,7 @@ void CL_BFGExplosionParticles (vec3_t org) p->next = active_particles; active_particles = p; - p->time = cl.time; + p->time = time; p->color = 0xd0 + (rand()&7); for (j=0 ; j<3 ; j++) { @@ -2077,7 +2115,7 @@ void CL_BFGExplosionParticles (vec3_t org) p->accel[2] = -PARTICLE_GRAVITY; 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; float vel; vec3_t dir; + float time; + time = (float)cl.time; for (i=-16 ; i<=16 ; i+=4) for (j=-16 ; j<=16 ; j+=4) @@ -2106,21 +2146,21 @@ void CL_TeleportParticles (vec3_t org) p->next = active_particles; active_particles = p; - p->time = cl.time; + p->time = time; p->color = 7 + (rand()&7); 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[1] = org[1] + j + (rand()&3); p->org[2] = org[2] + k + (rand()&3); - dir[0] = j*8; - dir[1] = i*8; - dir[2] = k*8; + dir[0] = j*8.0f; + dir[1] = i*8.0f; + dir[2] = k*8.0f; VectorNormalize (dir); - vel = 50 + (rand()&63); + vel = (float)(50 + (rand()&63)); VectorScale (dir, vel, p->vel); p->accel[0] = p->accel[1] = 0; @@ -2177,7 +2217,7 @@ void CL_AddParticles (void) tail = p; } - if (alpha > 1.0) + if (alpha > 1.0f) alpha = 1; color = p->color; time2 = time*time; @@ -2234,8 +2274,8 @@ void CL_EntityEvent (entity_state_t *ent) break; case EV_FALLFAR: S_StartSound (NULL, ent->number, CHAN_AUTO, S_RegisterSound ("*fall1.wav"), 1, ATTN_NORM, 0); - break; - } + break; + } } /* diff --git a/src/client/client.h b/src/client/client.h index 8eee3388..a2906222 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -466,7 +466,7 @@ void CL_BubbleTrail (vec3_t start, vec3_t end); #ifdef QMAX void CL_FlagTrail (vec3_t start, vec3_t end, qboolean isred); #else -void CL_FlagTrail (vec3_t start, vec3_t end, float color); +void CL_FlagTrail (vec3_t start, vec3_t end, int color); #endif // RAFAEL