mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-10 19:09:45 +01:00
Update left-moving star BG in fixed timestep loop
Otherwise they will move too fast.
This commit is contained in:
parent
495bea2e87
commit
55ae3c73a9
3 changed files with 28 additions and 8 deletions
|
@ -1813,14 +1813,6 @@ void Graphics::drawbackground( int t )
|
|||
{
|
||||
FillRect(backBuffer,stars[i], getRGB(0x55,0x55,0x55));
|
||||
}
|
||||
stars[i].x -= Sint16(starsspeed[i]);
|
||||
if (stars[i].x < -10)
|
||||
{
|
||||
stars[i].x += 340;
|
||||
stars[i].y = int(fRandom() * 240);
|
||||
stars[i].w = 2;
|
||||
starsspeed[i] = 4+int(fRandom()*4);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
@ -2187,6 +2179,28 @@ void Graphics::drawbackground( int t )
|
|||
}
|
||||
}
|
||||
|
||||
void Graphics::updatebackground(int t)
|
||||
{
|
||||
switch (t)
|
||||
{
|
||||
case 1:
|
||||
//Starfield
|
||||
for (int i = 0; i < 50; i++)
|
||||
{
|
||||
stars[i].w = 2;
|
||||
stars[i].h = 2;
|
||||
stars[i].x -= Sint16(starsspeed[i]);
|
||||
if (stars[i].x < -10)
|
||||
{
|
||||
stars[i].x += 340;
|
||||
stars[i].y = int(fRandom() * 240);
|
||||
stars[i].w = 2;
|
||||
starsspeed[i] = 4+int(fRandom()*4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::drawmap()
|
||||
{
|
||||
if (!foregrounddrawn)
|
||||
|
|
|
@ -164,6 +164,7 @@ public:
|
|||
void setcolreal(Uint32 t);
|
||||
|
||||
void drawbackground(int t);
|
||||
void updatebackground(int t);
|
||||
void drawtile3( int x, int y, int t, int off );
|
||||
void drawentcolours( int x, int y, int t);
|
||||
void drawtile2( int x, int y, int t );
|
||||
|
|
|
@ -1503,4 +1503,9 @@ void gamelogic()
|
|||
}
|
||||
|
||||
graphics.updatetextboxes();
|
||||
|
||||
if (!game.colourblindmode)
|
||||
{
|
||||
graphics.updatebackground(map.background);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue