1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2025-01-10 19:09:45 +01:00

Move setcol part of drawhuetile() to separate function

In order to make sure colors don't update more than 1000/34 frames per
second, I'll have to move the color-setting part of this function
somewhere else.
This commit is contained in:
Misa 2020-04-30 14:42:08 -07:00 committed by Ethan Lee
parent 2e17e872e4
commit fce56fde09
2 changed files with 15 additions and 9 deletions

View file

@ -1610,7 +1610,8 @@ void Graphics::drawentities()
} }
break; break;
case 4: // Small pickups case 4: // Small pickups
drawhuetile(xp, yp - yoff, obj.entities[i].tile, obj.entities[i].colour); huetilesetcol(obj.entities[i].colour);
drawhuetile(xp, yp - yoff, obj.entities[i].tile);
break; break;
case 5: //Horizontal Line case 5: //Horizontal Line
line_rect.x = xp; line_rect.x = xp;
@ -2640,7 +2641,7 @@ void Graphics::menuoffrender()
FillRect(backBuffer, 0x000000); FillRect(backBuffer, 0x000000);
} }
void Graphics::drawhuetile( int x, int y, int t, int c ) void Graphics::drawhuetile( int x, int y, int t )
{ {
if (!INBOUNDS(t, tiles)) if (!INBOUNDS(t, tiles))
{ {
@ -2649,7 +2650,16 @@ void Graphics::drawhuetile( int x, int y, int t, int c )
point tpoint; point tpoint;
tpoint.x = x; tpoint.x = x;
tpoint.y = y; tpoint.y = y;
switch(c)
SDL_Rect rect;
setRect(rect,tpoint.x,tpoint.y,tiles_rect.w, tiles_rect.h);
BlitSurfaceColoured(tiles[t],NULL,backBuffer, &rect, ct);
}
void Graphics::huetilesetcol(int t)
{
switch (t)
{ {
case 0: case 0:
setcolreal(getRGB(250-int(fRandom()*32), 250-int(fRandom()*32), 10)); setcolreal(getRGB(250-int(fRandom()*32), 250-int(fRandom()*32), 10));
@ -2661,11 +2671,6 @@ void Graphics::drawhuetile( int x, int y, int t, int c )
setcolreal(getRGB(250-int(fRandom()*32), 250-int(fRandom()*32), 10)); setcolreal(getRGB(250-int(fRandom()*32), 250-int(fRandom()*32), 10));
break; break;
} }
SDL_Rect rect;
setRect(rect,tpoint.x,tpoint.y,tiles_rect.w, tiles_rect.h);
BlitSurfaceColoured(tiles[t],NULL,backBuffer, &rect, ct);
} }
void Graphics::setwarprect( int a, int b, int c, int d ) void Graphics::setwarprect( int a, int b, int c, int d )

View file

@ -32,7 +32,8 @@ public:
void Makebfont(); void Makebfont();
void drawhuetile(int x, int y, int t, int c); void drawhuetile(int x, int y, int t);
void huetilesetcol(int t);
void drawgravityline(int t); void drawgravityline(int t);