HDB: Add _stars3D, _stars3DSlow + setup functions

This commit is contained in:
Nipun Garg 2019-06-08 02:25:11 +05:30 committed by Eugene Sandulenko
parent 703dbba648
commit f90d06bee9
2 changed files with 37 additions and 2 deletions

View file

@ -144,10 +144,10 @@ void DrawMan::setSky(int skyIndex) {
// Setup current sky
if (tileIndex == _tileSkyStars) {
warning("STUB: DRAWMAN::setSky: Setup3DStars");
setup3DStars();
return;
} else if (skyIndex == _tileSkyStarsLeft) {
warning("STUB: DRAWMAN::setSky: Setup3DStarsLeft");
setup3DStarsLeft();
return;
} else if (skyIndex == _tileSkyStars) {
warning("STUB: DRAWMAN::setSky: getPicture( CLOUDY_SKIES )");
@ -155,6 +155,25 @@ void DrawMan::setSky(int skyIndex) {
}
}
void DrawMan::setup3DStars() {
for (int i = 0; i < kNum3DStars; i++) {
_stars3D[i].x = g_hdb->_rnd->getRandomNumber(kScreenWidth) % kScreenWidth;
_stars3D[i].y = g_hdb->_rnd->getRandomNumber(kScreenHeight) % kScreenHeight;
_stars3D[i].speed = (g_hdb->_rnd->getRandomNumber(256) % 256);
_stars3D[i].speed >>= 1;
_stars3D[i].color = _stars3D[i].speed / 64;
}
}
void DrawMan::setup3DStarsLeft() {
for (int i = 0; i < kNum3DStars; i++) {
_stars3DSlow[i].x = g_hdb->_rnd->getRandomNumber(kScreenWidth) % kScreenWidth;
_stars3DSlow[i].y = g_hdb->_rnd->getRandomNumber(kScreenHeight) % kScreenHeight;
_stars3DSlow[i].speed = ((double) (1 + (g_hdb->_rnd->getRandomNumber(5) % 5))) / 6.0;
_stars3DSlow[i].color = (int) (_stars3DSlow[i].speed * 4.00);
}
}
Picture::~Picture() {
_surface.free();
}

View file

@ -57,12 +57,28 @@ public:
Picture *getPicture(const char *name);
int isSky(int skyIndex);
void setSky(int skyIndex);
void setup3DStars();
void setup3DStarsLeft();
// Add draw functions for the above two
//void draw3DStars();
//void draw3DStarsLeft();
private:
int _numTiles;
TileLookup *_tLookupArray;
uint16 _skyTiles[kMaxSkies];
int _currentSky; // 0 if no Sky, 1+ for which Sky to use
struct {
int x, y, speed;
uint16 color;
} _stars3D[kNum3DStars];
struct {
double x, y, speed;
uint16 color;
} _stars3DSlow[kNum3DStars];
int _tileSkyStars; // Index of sky_stars tile
int _tileSkyStarsLeft; // Left-scrolling stars, slow
int _tileSkyClouds; // Index of sky_stars tile