mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Implement crandk() and frandk() and remove old functions
This commit is contained in:
parent
253373dbda
commit
28c200a2e8
3 changed files with 28 additions and 16 deletions
|
@ -699,9 +699,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;
|
||||
|
@ -759,6 +756,8 @@ void SV_Frame (int msec);
|
|||
|
||||
/* Random number generator */
|
||||
int randk(void);
|
||||
float frandk(void);
|
||||
float crandk(void);
|
||||
void randk_seed(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -157,16 +157,6 @@ byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence)
|
|||
return r;
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -48,6 +48,29 @@ randk(void)
|
|||
return (int)KISS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate a pseudorandom
|
||||
* signed float between
|
||||
* 0 and 1.
|
||||
*/
|
||||
float
|
||||
frandk(void)
|
||||
{
|
||||
return (randk()&32767)* (1.0/32767);
|
||||
}
|
||||
|
||||
/* Generate a pseudorandom
|
||||
* float between -1 and 1.
|
||||
*/
|
||||
float
|
||||
crandk(void)
|
||||
{
|
||||
return (randk()&32767)* (2.0/32767) - 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Seeds the PRNG
|
||||
*/
|
||||
void
|
||||
randk_seed(void)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue