mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 02:11:19 +00:00
Fix random particle origin/velocity z component.
This is a quick fix until I get a random number generator into QF. Mingw's RAND_MAX is only 0x7fff and so the (((rnd >> 10) & 63) - 31.5) / 63.0 used for the z component of origin and velocity would never go positive. For now, change the 10 to 9 (reusing another bit from Y). I plan on implementing a full 32-bit PRNG in QF so we always have a reliable generator.
This commit is contained in:
parent
e8721122b1
commit
3de67589a3
4 changed files with 8 additions and 8 deletions
|
@ -113,11 +113,11 @@ particle_new_random (ptype_t type, int texnum, const vec3_t org, int org_fuzz,
|
|||
rnd = rand ();
|
||||
porg[0] = o_fuzz * ((rnd & 63) - 31.5) / 63.0 + org[0];
|
||||
porg[1] = o_fuzz * (((rnd >> 5) & 63) - 31.5) / 63.0 + org[1];
|
||||
porg[2] = o_fuzz * (((rnd >> 10) & 63) - 31.5) / 63.0 + org[2];
|
||||
porg[2] = o_fuzz * (((rnd >> 9) & 63) - 31.5) / 63.0 + org[2];
|
||||
rnd = rand ();
|
||||
pvel[0] = v_fuzz * ((rnd & 63) - 31.5) / 63.0;
|
||||
pvel[1] = v_fuzz * (((rnd >> 5) & 63) - 31.5) / 63.0;
|
||||
pvel[2] = v_fuzz * (((rnd >> 10) & 63) - 31.5) / 63.0;
|
||||
pvel[2] = v_fuzz * (((rnd >> 9) & 63) - 31.5) / 63.0;
|
||||
|
||||
particle_new (type, texnum, porg, scale, pvel, die, color, alpha, ramp);
|
||||
}
|
||||
|
|
|
@ -171,11 +171,11 @@ particle_new_random (ptype_t type, int texnum, const vec3_t org, int org_fuzz,
|
|||
rnd = rand ();
|
||||
porg[0] = o_fuzz * ((rnd & 63) - 31.5) / 63.0 + org[0];
|
||||
porg[1] = o_fuzz * (((rnd >> 5) & 63) - 31.5) / 63.0 + org[1];
|
||||
porg[2] = o_fuzz * (((rnd >> 10) & 63) - 31.5) / 63.0 + org[2];
|
||||
porg[2] = o_fuzz * (((rnd >> 9) & 63) - 31.5) / 63.0 + org[2];
|
||||
rnd = rand ();
|
||||
pvel[0] = v_fuzz * ((rnd & 63) - 31.5) / 63.0;
|
||||
pvel[1] = v_fuzz * (((rnd >> 5) & 63) - 31.5) / 63.0;
|
||||
pvel[2] = v_fuzz * (((rnd >> 10) & 63) - 31.5) / 63.0;
|
||||
pvel[2] = v_fuzz * (((rnd >> 9) & 63) - 31.5) / 63.0;
|
||||
|
||||
particle_new (type, texnum, porg, scale, pvel, die, color, alpha, ramp);
|
||||
}
|
||||
|
|
|
@ -908,11 +908,11 @@ R_Particle_NewRandom (ptype_t type, int texnum, const vec3_t org, int org_fuzz,
|
|||
rnd = rand ();
|
||||
porg[0] = o_fuzz * ((rnd & 63) - 31.5) / 63.0 + org[0];
|
||||
porg[1] = o_fuzz * (((rnd >> 5) & 63) - 31.5) / 63.0 + org[1];
|
||||
porg[2] = o_fuzz * (((rnd >> 10) & 63) - 31.5) / 63.0 + org[2];
|
||||
porg[2] = o_fuzz * (((rnd >> 9) & 63) - 31.5) / 63.0 + org[2];
|
||||
rnd = rand ();
|
||||
pvel[0] = v_fuzz * ((rnd & 63) - 31.5) / 63.0;
|
||||
pvel[1] = v_fuzz * (((rnd >> 5) & 63) - 31.5) / 63.0;
|
||||
pvel[2] = v_fuzz * (((rnd >> 10) & 63) - 31.5) / 63.0;
|
||||
pvel[2] = v_fuzz * (((rnd >> 9) & 63) - 31.5) / 63.0;
|
||||
|
||||
R_Particle_New (type, texnum, porg, scale, pvel, die, color, alpha, ramp);
|
||||
}
|
||||
|
|
|
@ -921,11 +921,11 @@ sw32_R_Particle_NewRandom (ptype_t type, int texnum, const vec3_t org,
|
|||
rnd = rand ();
|
||||
porg[0] = o_fuzz * ((rnd & 63) - 31.5) / 63.0 + org[0];
|
||||
porg[1] = o_fuzz * (((rnd >> 5) & 63) - 31.5) / 63.0 + org[1];
|
||||
porg[2] = o_fuzz * (((rnd >> 10) & 63) - 31.5) / 63.0 + org[2];
|
||||
porg[2] = o_fuzz * (((rnd >> 9) & 63) - 31.5) / 63.0 + org[2];
|
||||
rnd = rand ();
|
||||
pvel[0] = v_fuzz * ((rnd & 63) - 31.5) / 63.0;
|
||||
pvel[1] = v_fuzz * (((rnd >> 5) & 63) - 31.5) / 63.0;
|
||||
pvel[2] = v_fuzz * (((rnd >> 10) & 63) - 31.5) / 63.0;
|
||||
pvel[2] = v_fuzz * (((rnd >> 9) & 63) - 31.5) / 63.0;
|
||||
|
||||
sw32_R_Particle_New (type, texnum, porg, scale, pvel, die, color, alpha, ramp);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue