|
|
|
|
@ -16,20 +16,20 @@
|
|
|
|
|
DEVILUTION_BEGIN_NAMESPACE |
|
|
|
|
|
|
|
|
|
/** Seed value before the most recent call to SetRndSeed() */ |
|
|
|
|
int orgseed; |
|
|
|
|
Sint32 orgseed; |
|
|
|
|
/** Current game seed */ |
|
|
|
|
int sglGameSeed; |
|
|
|
|
Sint32 sglGameSeed; |
|
|
|
|
static CCritSect sgMemCrit; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Specifies the increment used in the Borland C/C++ pseudo-random. |
|
|
|
|
*/ |
|
|
|
|
const int RndInc = 1; |
|
|
|
|
const Uint32 RndInc = 1; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Specifies the multiplier used in the Borland C/C++ pseudo-random number generator algorithm. |
|
|
|
|
*/ |
|
|
|
|
const int RndMult = 0x015A4E35; |
|
|
|
|
const Uint32 RndMult = 0x015A4E35; |
|
|
|
|
|
|
|
|
|
void CelDrawTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) |
|
|
|
|
{ |
|
|
|
|
@ -634,7 +634,7 @@ int GetDirection(int x1, int y1, int x2, int y2)
|
|
|
|
|
* @brief Set the RNG seed |
|
|
|
|
* @param s RNG seed |
|
|
|
|
*/ |
|
|
|
|
void SetRndSeed(int s) |
|
|
|
|
void SetRndSeed(Sint32 s) |
|
|
|
|
{ |
|
|
|
|
sglGameSeed = s; |
|
|
|
|
orgseed = s; |
|
|
|
|
@ -644,9 +644,9 @@ void SetRndSeed(int s)
|
|
|
|
|
* @brief Advance the internal RNG seed and return the new value |
|
|
|
|
* @return RNG seed |
|
|
|
|
*/ |
|
|
|
|
int AdvanceRndSeed() |
|
|
|
|
Sint32 AdvanceRndSeed() |
|
|
|
|
{ |
|
|
|
|
sglGameSeed = static_cast<unsigned int>(RndMult) * sglGameSeed + RndInc; |
|
|
|
|
sglGameSeed = (RndMult * static_cast<Uint32>(sglGameSeed)) + RndInc; |
|
|
|
|
return abs(sglGameSeed); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -654,7 +654,7 @@ int AdvanceRndSeed()
|
|
|
|
|
* @brief Get the current RNG seed |
|
|
|
|
* @return RNG seed |
|
|
|
|
*/ |
|
|
|
|
int GetRndSeed() |
|
|
|
|
Sint32 GetRndSeed() |
|
|
|
|
{ |
|
|
|
|
return abs(sglGameSeed); |
|
|
|
|
} |
|
|
|
|
@ -665,7 +665,7 @@ int GetRndSeed()
|
|
|
|
|
* @param v The upper limit for the return value |
|
|
|
|
* @return A random number from 0 to (v-1) |
|
|
|
|
*/ |
|
|
|
|
int random_(BYTE idx, int v) |
|
|
|
|
Sint32 random_(BYTE idx, Sint32 v) |
|
|
|
|
{ |
|
|
|
|
if (v <= 0) |
|
|
|
|
return 0; |
|
|
|
|
|