void InitialisePresents() { for(int i=0; i<BOXES; i++){ int j=BOX1+i; Entities[j]=new Box(j,true); Entities[j]->geometry=&models[BOXMDL]; Entities[j]->geometry->get_boundaries(Entities[j]->geometry_bounds); Entities[j]->stuff=&materials[CRT]; //Entities[j]->chaindesign(0,&materials[CRT]); ((Box*)Entities[j])->reset(Randomise("BOX")); } }
void mapCavern::Generate() { for (int i = 0; i < m_width * m_height; i++) //clear us to fully rock { m_tile[i].wall = WALL_Solid; m_tile[i].material = MATERIAL_Rock; m_tile[i].border = false; } Randomise(); HighPassOne(); HighPassTwo(); HighPassThree(); HighPassThree(); }
int RNG :: Random( int begin, int end ) { if ( mNeedRandomise ) { Randomise( mLastSeed ); } if ( begin >= end ) { throw Exception( "Invalid random number range" ); } int n = end - begin; const int bsize = INT_MAX / n; int r; do { r = theGen() / bsize; } while( r >= n ); return begin + r; }
void InitialiseIsles() { for(int i=0; i<ISLES; i++){ int j=ISLE1+i; Entities[j]=new Island(j,true); Entities[j]->geometry=&models[ISLEMDL]; Entities[j]->geometry->get_boundaries(Entities[j]->geometry_bounds); Entities[j]->current=Randomise("ISLE"); Entities[j]->quad(Entities[j]->current,Entities[j]->geometry->get_origin(),Entities[j]->currentquad); Entities[j]->mark(Entities[j]->currentquad); Entities[j]->stuff=&materials[ISL]; Entities[j]->chaindesign(0,&materials[ISL]); int k=FIRST_ISLE_PROJECTILE+i; Entities[k]=new Boulder(k,j,true); Entities[k]->geometry=&models[ISLPRJMDL]; Entities[k]->geometry->get_boundaries(Entities[k]->geometry_bounds); Entities[k]->stuff=&materials[ISL]; Entities[k]->chaindesign(0,&materials[ISL]); } }
/* * Random Constructor *-------------------------------------------------- * No Argument constructor – Initialises low and * height. * Initialises random generator */ Random::Random(int low, int high){ this->low = low; this->high = high; Randomise(); }
int RNG :: Random() { if ( mNeedRandomise ) { Randomise( mLastSeed ); } return theGen(); }
void RNG::Randomise() { if ( mNeedRandomise ) { Randomise( mLastSeed ); } }