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 // Setup current sky
if (tileIndex == _tileSkyStars) { if (tileIndex == _tileSkyStars) {
warning("STUB: DRAWMAN::setSky: Setup3DStars"); setup3DStars();
return; return;
} else if (skyIndex == _tileSkyStarsLeft) { } else if (skyIndex == _tileSkyStarsLeft) {
warning("STUB: DRAWMAN::setSky: Setup3DStarsLeft"); setup3DStarsLeft();
return; return;
} else if (skyIndex == _tileSkyStars) { } else if (skyIndex == _tileSkyStars) {
warning("STUB: DRAWMAN::setSky: getPicture( CLOUDY_SKIES )"); 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() { Picture::~Picture() {
_surface.free(); _surface.free();
} }

View file

@ -57,12 +57,28 @@ public:
Picture *getPicture(const char *name); Picture *getPicture(const char *name);
int isSky(int skyIndex); int isSky(int skyIndex);
void setSky(int skyIndex); void setSky(int skyIndex);
void setup3DStars();
void setup3DStarsLeft();
// Add draw functions for the above two
//void draw3DStars();
//void draw3DStarsLeft();
private: private:
int _numTiles; int _numTiles;
TileLookup *_tLookupArray; TileLookup *_tLookupArray;
uint16 _skyTiles[kMaxSkies]; uint16 _skyTiles[kMaxSkies];
int _currentSky; // 0 if no Sky, 1+ for which Sky to use 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 _tileSkyStars; // Index of sky_stars tile
int _tileSkyStarsLeft; // Left-scrolling stars, slow int _tileSkyStarsLeft; // Left-scrolling stars, slow
int _tileSkyClouds; // Index of sky_stars tile int _tileSkyClouds; // Index of sky_stars tile