Browse Source

Remove hsRand--we have rand support in the Cstdlib

Adam Johnson 13 years ago
parent
commit
5f78b33db4
  1. 14
      Sources/Plasma/CoreLib/HeadSpin.cpp
  2. 5
      Sources/Plasma/CoreLib/HeadSpin.h
  3. 4
      Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp
  4. 2
      Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.cpp
  5. 2
      Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.h

14
Sources/Plasma/CoreLib/HeadSpin.cpp

@ -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);
}
/* 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[])
{

5
Sources/Plasma/CoreLib/HeadSpin.h

@ -520,11 +520,6 @@ inline float hsRadiansToDegrees(float rad) { return float(rad * (180 / M_PI)); }
# define ALIGN(n) __atribute__(aligned(n))
#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)
char** DisplaySystemVersion();

4
Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp

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

2
Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.cpp

@ -435,7 +435,7 @@ int32_t plSpaceTreeMaker::AddLeaf(const hsBounds3Ext& worldBnd, hsBool disable)
#define MF_DO_3D
#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
#define MF_SETPOINT(pt,a,b,c) pt.Set(a,b,c)
#endif // MF_DO_RAND

2
Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.h

@ -65,7 +65,7 @@ public:
static void ComputeDirection(float pitch, float yaw, hsVector3 &direction);
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

Loading…
Cancel
Save