1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 18:59:09 +00:00

Remove hsRand--we have rand support in the Cstdlib

This commit is contained in:
2012-06-17 20:51:31 -04:00
parent f0af98b0a7
commit 5f78b33db4
5 changed files with 4 additions and 23 deletions

View File

@ -377,20 +377,6 @@ int hsMessageBox(const wchar_t message[], const wchar_t caption[], int kind, int
return hsMessageBoxWithOwner((hsWindowHndl)nil,message,caption,kind,icon); return hsMessageBoxWithOwner((hsWindowHndl)nil,message,caption,kind,icon);
} }
/* Generic psuedo RNG used in ANSI C. */
static unsigned long SEED = 1;
int hsRand()
{
register int temp;
SEED = SEED * 1103515245 + 12345;
temp = (int)((SEED/65536)&32767);
return (temp);
}
void hsRandSeed(int seed)
{
SEED = seed;
}
/**************************************/ /**************************************/
char* hsStrcpy(char dst[], const char src[]) char* hsStrcpy(char dst[], const char src[])
{ {

View File

@ -520,11 +520,6 @@ inline float hsRadiansToDegrees(float rad) { return float(rad * (180 / M_PI)); }
# define ALIGN(n) __atribute__(aligned(n)) # define ALIGN(n) __atribute__(aligned(n))
#endif #endif
inline int hsRandMax() { return 32767; }
inline float hsRandNorm() { return 1.f / 32767.f; } // multiply by hsRand to get randoms ranged [0..1]
int hsRand(void);
void hsRandSeed(int seed);
#define hsFopen(name, mode) fopen(name, mode) #define hsFopen(name, mode) fopen(name, mode)
char** DisplaySystemVersion(); char** DisplaySystemVersion();

View File

@ -128,7 +128,7 @@ int plRandomCommandMod::IExcludeSelections(int ncmds)
float plRandomCommandMod::IGetDelay(float len) const float plRandomCommandMod::IGetDelay(float len) const
{ {
float r = float(hsRand() * kRandNormalize); float r = float(rand() * kRandNormalize);
float delay = fMinDelay + (fMaxDelay - fMinDelay) * r; float delay = fMinDelay + (fMaxDelay - fMinDelay) * r;
@ -156,7 +156,7 @@ hsBool plRandomCommandMod::ISelectNext(int ncmds)
} }
return true; return true;
} }
float r = float(hsRand() * kRandNormalize); float r = float(rand() * kRandNormalize);
int nSelect = ncmds; int nSelect = ncmds;

View File

@ -435,7 +435,7 @@ int32_t plSpaceTreeMaker::AddLeaf(const hsBounds3Ext& worldBnd, hsBool disable)
#define MF_DO_3D #define MF_DO_3D
#ifdef MF_DO_RAND #ifdef MF_DO_RAND
#define MF_SETPOINT(pt,a,b,c) pt.Set(hsRand()/32767.f, hsRand()/32767.f, hsRand()/32767.f) #define MF_SETPOINT(pt,a,b,c) pt.Set(rand()/32767.f, rand()/32767.f, rand()/32767.f)
#else // MF_DO_RAND #else // MF_DO_RAND
#define MF_SETPOINT(pt,a,b,c) pt.Set(a,b,c) #define MF_SETPOINT(pt,a,b,c) pt.Set(a,b,c)
#endif // MF_DO_RAND #endif // MF_DO_RAND

View File

@ -65,7 +65,7 @@ public:
static void ComputeDirection(float pitch, float yaw, hsVector3 &direction); static void ComputeDirection(float pitch, float yaw, hsVector3 &direction);
static void ComputePitchYaw(float &pitch, float &yaw, const hsVector3 &dir); static void ComputePitchYaw(float &pitch, float &yaw, const hsVector3 &dir);
static inline float GetRandomVar() { return 2.0f * (float)hsRand() / RAND_MAX - 1; } // returns a num between +/- 1.0 static inline float GetRandomVar() { return 2.0f * rand() / RAND_MAX - 1; } // returns a num between +/- 1.0
}; };
class plSimpleParticleGenerator : public plParticleGenerator class plSimpleParticleGenerator : public plParticleGenerator