mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-01 05:30:58 +00:00
frand() und crand() ersetzt und kleinere änderungen in cl_fx.c
This commit is contained in:
parent
f3ce546a5d
commit
06099868fb
5 changed files with 13 additions and 16 deletions
|
@ -909,7 +909,7 @@ void CL_ParticleEffect2 (vec3_t org, vec3_t dir, int color, int count) {
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = color + (rand()&7);
|
||||
p->color = color + (mtrand()&7);
|
||||
|
||||
d = (float)(mtrand()&7);
|
||||
|
||||
|
@ -1924,8 +1924,8 @@ void CL_BFGExplosionParticles (vec3_t org) {
|
|||
p->color = 0xd0 + (mtrand()&7);
|
||||
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
p->org[j] = org[j] + ((rand()%32)-16);
|
||||
p->vel[j] = (rand()%384)-192;
|
||||
p->org[j] = org[j] + crand() * 16;
|
||||
p->vel[j] = crand() * 192;
|
||||
}
|
||||
|
||||
p->accel[0] = p->accel[1] = 0;
|
||||
|
|
|
@ -1334,16 +1334,6 @@ byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence)
|
|||
|
||||
//========================================================
|
||||
|
||||
float frand(void)
|
||||
{
|
||||
return (rand()&32767)* (1.0/32767);
|
||||
}
|
||||
|
||||
float crand(void)
|
||||
{
|
||||
return (rand()&32767)* (2.0/32767) - 1;
|
||||
}
|
||||
|
||||
#ifndef DEDICATED_ONLY
|
||||
void Key_Init (void);
|
||||
void SCR_EndLoadingPlaque (void);
|
||||
|
|
|
@ -759,9 +759,6 @@ void Com_SetServerState (int state);
|
|||
unsigned Com_BlockChecksum (void *buffer, int length);
|
||||
byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence);
|
||||
|
||||
float frand(void); // 0 ti 1
|
||||
float crand(void); // -1 to 1
|
||||
|
||||
extern cvar_t *developer;
|
||||
extern cvar_t *modder;
|
||||
extern cvar_t *dedicated;
|
||||
|
|
|
@ -506,6 +506,10 @@ extern edict_t *g_edicts;
|
|||
#define LLOFS(x) (size_t)&(((level_locals_t *)NULL)->x)
|
||||
#define CLOFS(x) (size_t)&(((gclient_t *)NULL)->x)
|
||||
|
||||
#ifdef random
|
||||
#undef random
|
||||
#endif
|
||||
|
||||
#define random() ((rand () & 0x7fff) / ((float)0x7fff))
|
||||
#define crandom() (2.0 * (random() - 0.5))
|
||||
|
||||
|
|
|
@ -31,6 +31,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
typedef unsigned char byte;
|
||||
typedef enum {false, true} qboolean;
|
||||
|
||||
//32 bit float precision caps this to 0.00000000023283064f which gives max result of .99999998407391880
|
||||
#define random() ((mtrand() * 0.00000000023283064f))
|
||||
|
||||
|
||||
#define frand() (random())
|
||||
#define crand() (((int)mtrand() - 0x7FFFFFFF) * 0.000000000465661287307739257812f)
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *)0)
|
||||
|
|
Loading…
Reference in a new issue