mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-31 22:19:44 +01:00
Axe RGBflip()
in favor of getRGB()
RGBflip() does the exact same thing as getRGB(), now that all the surface masks have been fixed. This axes RGBflip() and changes all callers to use getRGB() instead. It is more readable that way. By doing this, there is less copy-pasting. Additionally, it is now easier to search for RGBf() - which is an ENTIRELY different function than RGBflip() - now that the name of RGBf is no longer the first four characters of some different, unrelated function. Previously I would've had to do `rg 'RGBf[^\w]'` which was stupid and awful and I hated it.
This commit is contained in:
parent
f237f41d8e
commit
d3a868b566
3 changed files with 66 additions and 73 deletions
|
@ -2207,62 +2207,62 @@ void Graphics::drawbackground( int t )
|
|||
{
|
||||
//Akward ordering to match tileset
|
||||
case 0:
|
||||
bcol2 = RGBflip(0, 16*backboxint[0], 16*backboxint[0]);
|
||||
bcol2 = getRGB(0, 16*backboxint[0], 16*backboxint[0]);
|
||||
break; //Cyan
|
||||
case 1:
|
||||
bcol2 = RGBflip(16*backboxint[0], 0, 0);
|
||||
bcol2 = getRGB(16*backboxint[0], 0, 0);
|
||||
break; //Red
|
||||
case 2:
|
||||
bcol2 = RGBflip(16*backboxint[0], 0, 16*backboxint[0]);
|
||||
bcol2 = getRGB(16*backboxint[0], 0, 16*backboxint[0]);
|
||||
break; //Purple
|
||||
case 3:
|
||||
bcol2 = RGBflip(0, 0, 16*backboxint[0]);
|
||||
bcol2 = getRGB(0, 0, 16*backboxint[0]);
|
||||
break; //Blue
|
||||
case 4:
|
||||
bcol2 = RGBflip(16*backboxint[0], 16*backboxint[0], 0);
|
||||
bcol2 = getRGB(16*backboxint[0], 16*backboxint[0], 0);
|
||||
break; //Yellow
|
||||
case 5:
|
||||
bcol2 = RGBflip(0, 16 * backboxint[0], 0);
|
||||
bcol2 = getRGB(0, 16 * backboxint[0], 0);
|
||||
break; //Green
|
||||
case 6:
|
||||
//crazy case
|
||||
switch(spcol)
|
||||
{
|
||||
case 0:
|
||||
bcol2 = RGBflip(0, 16*backboxint[0], 16*backboxint[0]);
|
||||
bcol2 = getRGB(0, 16*backboxint[0], 16*backboxint[0]);
|
||||
break; //Cyan
|
||||
case 1:
|
||||
bcol2 = RGBflip(0, (spcoldel+1)*backboxint[0], 16*backboxint[0]);
|
||||
bcol2 = getRGB(0, (spcoldel+1)*backboxint[0], 16*backboxint[0]);
|
||||
break; //Cyan
|
||||
case 2:
|
||||
bcol2 = RGBflip(0, 0, 16*backboxint[0]);
|
||||
bcol2 = getRGB(0, 0, 16*backboxint[0]);
|
||||
break; //Blue
|
||||
case 3:
|
||||
bcol2 = RGBflip((16-spcoldel)*backboxint[0], 0, 16*backboxint[0]);
|
||||
bcol2 = getRGB((16-spcoldel)*backboxint[0], 0, 16*backboxint[0]);
|
||||
break; //Blue
|
||||
case 4:
|
||||
bcol2 = RGBflip(16*backboxint[0], 0, 16*backboxint[0]);
|
||||
bcol2 = getRGB(16*backboxint[0], 0, 16*backboxint[0]);
|
||||
break; //Purple
|
||||
case 5:
|
||||
bcol2 = RGBflip(16*backboxint[0], 0, (spcoldel+1)*backboxint[0]);
|
||||
bcol2 = getRGB(16*backboxint[0], 0, (spcoldel+1)*backboxint[0]);
|
||||
break; //Purple
|
||||
case 6:
|
||||
bcol2 = RGBflip(16*backboxint[0], 0, 0);
|
||||
bcol2 = getRGB(16*backboxint[0], 0, 0);
|
||||
break; //Red
|
||||
case 7:
|
||||
bcol2 = RGBflip(16*backboxint[0], (16-spcoldel)*backboxint[0], 0);
|
||||
bcol2 = getRGB(16*backboxint[0], (16-spcoldel)*backboxint[0], 0);
|
||||
break; //Red
|
||||
case 8:
|
||||
bcol2 = RGBflip(16*backboxint[0], 16*backboxint[0], 0);
|
||||
bcol2 = getRGB(16*backboxint[0], 16*backboxint[0], 0);
|
||||
break; //Yellow
|
||||
case 9:
|
||||
bcol2 = RGBflip((spcoldel+1)*backboxint[0], 16*backboxint[0], 0);
|
||||
bcol2 = getRGB((spcoldel+1)*backboxint[0], 16*backboxint[0], 0);
|
||||
break; //Yellow
|
||||
case 10:
|
||||
bcol2 = RGBflip(0, 16 * backboxint[0], 0);
|
||||
bcol2 = getRGB(0, 16 * backboxint[0], 0);
|
||||
break; //Green
|
||||
case 11:
|
||||
bcol2 = RGBflip(0, 16 * backboxint[0], (16-spcoldel)*backboxint[0]);
|
||||
bcol2 = getRGB(0, 16 * backboxint[0], (16-spcoldel)*backboxint[0]);
|
||||
break; //Green
|
||||
}
|
||||
break;
|
||||
|
@ -2275,62 +2275,62 @@ void Graphics::drawbackground( int t )
|
|||
{
|
||||
//Akward ordering to match tileset
|
||||
case 0:
|
||||
bcol = RGBflip(16, 128*backboxint[0], 128*backboxint[0]);
|
||||
bcol = getRGB(16, 128*backboxint[0], 128*backboxint[0]);
|
||||
break; //Cyan
|
||||
case 1:
|
||||
bcol = RGBflip(128*backboxint[0], 16, 16);
|
||||
bcol = getRGB(128*backboxint[0], 16, 16);
|
||||
break; //Red
|
||||
case 2:
|
||||
bcol = RGBflip(128*backboxint[0], 16, 128*backboxint[0]);
|
||||
bcol = getRGB(128*backboxint[0], 16, 128*backboxint[0]);
|
||||
break; //Purple
|
||||
case 3:
|
||||
bcol = RGBflip(16, 16, 128*backboxint[0]);
|
||||
bcol = getRGB(16, 16, 128*backboxint[0]);
|
||||
break; //Blue
|
||||
case 4:
|
||||
bcol = RGBflip(128*backboxint[0], 128*backboxint[0], 16);
|
||||
bcol = getRGB(128*backboxint[0], 128*backboxint[0], 16);
|
||||
break; //Yellow
|
||||
case 5:
|
||||
bcol = RGBflip(16, 128 * backboxint[0], 16);
|
||||
bcol = getRGB(16, 128 * backboxint[0], 16);
|
||||
break; //Green
|
||||
case 6:
|
||||
//crazy case
|
||||
switch(spcol)
|
||||
{
|
||||
case 0:
|
||||
bcol = RGBflip(16, 128*backboxint[0], 128*backboxint[0]);
|
||||
bcol = getRGB(16, 128*backboxint[0], 128*backboxint[0]);
|
||||
break; //Cyan
|
||||
case 1:
|
||||
bcol = RGBflip(16, ((spcoldel+1)*8)*backboxint[0], 128*backboxint[0]);
|
||||
bcol = getRGB(16, ((spcoldel+1)*8)*backboxint[0], 128*backboxint[0]);
|
||||
break; //Cyan
|
||||
case 2:
|
||||
bcol = RGBflip(16, 16, 128*backboxint[0]);
|
||||
bcol = getRGB(16, 16, 128*backboxint[0]);
|
||||
break; //Blue
|
||||
case 3:
|
||||
bcol = RGBflip((128-(spcoldel*8))*backboxint[0], 16, 128*backboxint[0]);
|
||||
bcol = getRGB((128-(spcoldel*8))*backboxint[0], 16, 128*backboxint[0]);
|
||||
break; //Blue
|
||||
case 4:
|
||||
bcol = RGBflip(128*backboxint[0], 16, 128*backboxint[0]);
|
||||
bcol = getRGB(128*backboxint[0], 16, 128*backboxint[0]);
|
||||
break; //Purple
|
||||
case 5:
|
||||
bcol = RGBflip(128*backboxint[0], 16, ((spcoldel+1)*8)*backboxint[0]);
|
||||
bcol = getRGB(128*backboxint[0], 16, ((spcoldel+1)*8)*backboxint[0]);
|
||||
break; //Purple
|
||||
case 6:
|
||||
bcol = RGBflip(128*backboxint[0], 16, 16);
|
||||
bcol = getRGB(128*backboxint[0], 16, 16);
|
||||
break; //Red
|
||||
case 7:
|
||||
bcol = RGBflip(128*backboxint[0], (128-(spcoldel*8))*backboxint[0], 16);
|
||||
bcol = getRGB(128*backboxint[0], (128-(spcoldel*8))*backboxint[0], 16);
|
||||
break; //Red
|
||||
case 8:
|
||||
bcol = RGBflip(128*backboxint[0], 128*backboxint[0], 16);
|
||||
bcol = getRGB(128*backboxint[0], 128*backboxint[0], 16);
|
||||
break; //Yellow
|
||||
case 9:
|
||||
bcol = RGBflip(((spcoldel+1)*8)*backboxint[0], 128*backboxint[0], 16);
|
||||
bcol = getRGB(((spcoldel+1)*8)*backboxint[0], 128*backboxint[0], 16);
|
||||
break; //Yellow
|
||||
case 10:
|
||||
bcol = RGBflip(16, 128 * backboxint[0], 16);
|
||||
bcol = getRGB(16, 128 * backboxint[0], 16);
|
||||
break; //Green
|
||||
case 11:
|
||||
bcol = RGBflip(16, 128 * backboxint[0], (128-(spcoldel*8))*backboxint[0]);
|
||||
bcol = getRGB(16, 128 * backboxint[0], (128-(spcoldel*8))*backboxint[0]);
|
||||
break; //Green
|
||||
}
|
||||
break;
|
||||
|
@ -2367,36 +2367,36 @@ void Graphics::drawbackground( int t )
|
|||
{
|
||||
//Akward ordering to match tileset
|
||||
case 0:
|
||||
warpbcol = RGBflip(0x0A, 0x10, 0x0E);
|
||||
warpfcol = RGBflip(0x10, 0x22, 0x21);
|
||||
warpbcol = getRGB(0x0A, 0x10, 0x0E);
|
||||
warpfcol = getRGB(0x10, 0x22, 0x21);
|
||||
break; //Cyan
|
||||
case 1:
|
||||
warpbcol = RGBflip(0x11, 0x09, 0x0B);
|
||||
warpfcol = RGBflip(0x22, 0x10, 0x11);
|
||||
warpbcol = getRGB(0x11, 0x09, 0x0B);
|
||||
warpfcol = getRGB(0x22, 0x10, 0x11);
|
||||
break; //Red
|
||||
case 2:
|
||||
warpbcol = RGBflip(0x0F, 0x0A, 0x10);
|
||||
warpfcol = RGBflip(0x22,0x10,0x22);
|
||||
warpbcol = getRGB(0x0F, 0x0A, 0x10);
|
||||
warpfcol = getRGB(0x22,0x10,0x22);
|
||||
break; //Purple
|
||||
case 3:
|
||||
warpbcol = RGBflip(0x0A, 0x0B, 0x10);
|
||||
warpfcol = RGBflip(0x10, 0x10, 0x22);
|
||||
warpbcol = getRGB(0x0A, 0x0B, 0x10);
|
||||
warpfcol = getRGB(0x10, 0x10, 0x22);
|
||||
break; //Blue
|
||||
case 4:
|
||||
warpbcol = RGBflip(0x10, 0x0D, 0x0A);
|
||||
warpfcol = RGBflip(0x22, 0x1E, 0x10);
|
||||
warpbcol = getRGB(0x10, 0x0D, 0x0A);
|
||||
warpfcol = getRGB(0x22, 0x1E, 0x10);
|
||||
break; //Yellow
|
||||
case 5:
|
||||
warpbcol = RGBflip(0x0D, 0x10, 0x0A);
|
||||
warpfcol = RGBflip(0x14, 0x22, 0x10);
|
||||
warpbcol = getRGB(0x0D, 0x10, 0x0A);
|
||||
warpfcol = getRGB(0x14, 0x22, 0x10);
|
||||
break; //Green
|
||||
case 6:
|
||||
warpbcol = RGBflip(0x0A, 0x0A, 0x0A);
|
||||
warpfcol = RGBflip(0x12, 0x12, 0x12);
|
||||
warpbcol = getRGB(0x0A, 0x0A, 0x0A);
|
||||
warpfcol = getRGB(0x12, 0x12, 0x12);
|
||||
break; //Gray
|
||||
default:
|
||||
warpbcol = RGBflip(0xFF, 0xFF, 0xFF);
|
||||
warpfcol = RGBflip(0xFF, 0xFF, 0xFF);
|
||||
warpbcol = getRGB(0xFF, 0xFF, 0xFF);
|
||||
warpfcol = getRGB(0xFF, 0xFF, 0xFF);
|
||||
}
|
||||
|
||||
for (int i = 10 ; i >= 0; i--)
|
||||
|
@ -3259,11 +3259,6 @@ Uint32 Graphics::getRGB(Uint32 _col)
|
|||
return ( _col);
|
||||
}
|
||||
|
||||
Uint32 Graphics::RGBflip(Uint8 r, Uint8 g, Uint8 b)
|
||||
{
|
||||
return SDL_MapRGB(backBuffer->format, r, g, b);
|
||||
}
|
||||
|
||||
Uint32 Graphics::RGBf(int r, int g, int b)
|
||||
{
|
||||
r = (r+128) / 3;
|
||||
|
|
|
@ -185,8 +185,6 @@ public:
|
|||
|
||||
Uint32 getRGB(Uint32 _col);
|
||||
|
||||
Uint32 RGBflip(Uint8 r, Uint8 g, Uint8 b);
|
||||
|
||||
|
||||
Uint32 RGBf(int r, int g, int b);
|
||||
|
||||
|
|
|
@ -54,32 +54,32 @@ void preloaderrender(void)
|
|||
if(pre_transition>=30){
|
||||
switch(pre_curcol) {
|
||||
case 0:
|
||||
pre_lightcol = graphics.RGBflip(0xBF,0x59,0x6F);
|
||||
pre_darkcol = graphics.RGBflip(0x88,0x3E,0x53);
|
||||
pre_lightcol = graphics.getRGB(0xBF,0x59,0x6F);
|
||||
pre_darkcol = graphics.getRGB(0x88,0x3E,0x53);
|
||||
break;
|
||||
case 1:
|
||||
pre_lightcol = graphics.RGBflip(0x6C,0xBC,0x5C);
|
||||
pre_darkcol = graphics.RGBflip(0x50,0x86,0x40);
|
||||
pre_lightcol = graphics.getRGB(0x6C,0xBC,0x5C);
|
||||
pre_darkcol = graphics.getRGB(0x50,0x86,0x40);
|
||||
break;
|
||||
case 2:
|
||||
pre_lightcol = graphics.RGBflip(0x5D,0x57,0xAA);
|
||||
pre_darkcol = graphics.RGBflip(0x2F,0x2F,0x6C);
|
||||
pre_lightcol = graphics.getRGB(0x5D,0x57,0xAA);
|
||||
pre_darkcol = graphics.getRGB(0x2F,0x2F,0x6C);
|
||||
break;
|
||||
case 3:
|
||||
pre_lightcol = graphics.RGBflip(0xB7,0xBA,0x5E);
|
||||
pre_darkcol = graphics.RGBflip(0x84,0x83,0x42);
|
||||
pre_lightcol = graphics.getRGB(0xB7,0xBA,0x5E);
|
||||
pre_darkcol = graphics.getRGB(0x84,0x83,0x42);
|
||||
break;
|
||||
case 4:
|
||||
pre_lightcol = graphics.RGBflip(0x57,0x90,0xAA);
|
||||
pre_darkcol = graphics.RGBflip(0x2F,0x5B,0x6C);
|
||||
pre_lightcol = graphics.getRGB(0x57,0x90,0xAA);
|
||||
pre_darkcol = graphics.getRGB(0x2F,0x5B,0x6C);
|
||||
break;
|
||||
case 5:
|
||||
pre_lightcol = graphics.RGBflip(0x90,0x61,0xB1);
|
||||
pre_darkcol = graphics.RGBflip(0x58,0x3D,0x71);
|
||||
pre_lightcol = graphics.getRGB(0x90,0x61,0xB1);
|
||||
pre_darkcol = graphics.getRGB(0x58,0x3D,0x71);
|
||||
break;
|
||||
default:
|
||||
pre_lightcol = graphics.RGBflip(0x00,0x00,0x00);
|
||||
pre_darkcol = graphics.RGBflip(0x08,0x00,0x00);
|
||||
pre_lightcol = graphics.getRGB(0x00,0x00,0x00);
|
||||
pre_darkcol = graphics.getRGB(0x08,0x00,0x00);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue