Imports the current Win32 source for the pod-racing game 'Red Planet', built on the MUNGA engine and its L4 (Win32/DirectX) platform layer: - MUNGA / MUNGA_L4: cross-platform engine core and Win32 backend - RP / RP_L4: Red Planet game logic and Win32 application - DivLoader, Setup1: asset loader and installer project - lib, MUNGA_L4/openal, MUNGA_L4/sos: third-party audio dependencies Removed stale Subversion metadata and added .gitignore/.gitattributes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
54 lines
1.0 KiB
C++
54 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include "scalar.h"
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Random ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
class RandomGenerator SIGNATURED
|
|
{
|
|
private:
|
|
static int Numbers[250]; // the random number table
|
|
static int Index; // the current entry within the table
|
|
|
|
static void Init();
|
|
|
|
static int GetRandomInt();
|
|
|
|
public:
|
|
RandomGenerator()
|
|
{
|
|
if (Index == -1)
|
|
Init();
|
|
}
|
|
|
|
//
|
|
//------------------------
|
|
// Random number functions
|
|
//------------------------
|
|
//
|
|
int GetInt() // returns 0 .. RAND_MAX
|
|
{
|
|
return GetRandomInt();
|
|
}
|
|
|
|
operator Scalar(); // returns 0.0f <= x < 1.0f
|
|
int operator ()(int Range); // returns 0 .. Range-1
|
|
|
|
static Logical TestClass();
|
|
};
|
|
|
|
extern RandomGenerator Random;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Die ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
class Die SIGNATURED
|
|
{
|
|
private:
|
|
int highestRandom; // the highest random number giving a uniform dist.
|
|
int dieSides; // the number of sides on the die (starting from 1)
|
|
|
|
public:
|
|
Die(int sides);
|
|
operator int(); // returns 1 .. dieSides
|
|
};
|