From f237f41d8eb31dcd5bab499a0029a33139ca2c96 Mon Sep 17 00:00:00 2001 From: Misa Date: Sat, 11 Sep 2021 02:12:03 -0700 Subject: [PATCH] Remove useless arguments from drawimagecol() Turns out, the r, g, and b arguments don't actually do anything! There was a call to RGBf() in the function. RGBf() is just getRGB() but first adds 128 and then divides by 3 to each of the color channels beforehand. Unfortunately, RGBf() does not have any side effects, and the function threw away the return value. Bravo. This also reveals that the website images drawn in the credits in the main menu are only recolored because of a stale `ct` set by the previous graphics.bigprint(), and not because any color values were passed in to drawimagecol()... What fun surprises the game has in store for me every day. --- desktop_version/src/Graphics.cpp | 6 +----- desktop_version/src/Graphics.h | 2 +- desktop_version/src/Render.cpp | 6 +++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 5f5a75be..e33e8f93 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -1090,17 +1090,13 @@ void Graphics::updatetextboxes(void) } } -void Graphics::drawimagecol( int t, int xp, int yp, int r = 0, int g = 0, int b = 0, bool cent/*= false*/ ) +void Graphics::drawimagecol( int t, int xp, int yp, bool cent/*= false*/ ) { if (!INBOUNDS_VEC(t, images)) { return; } SDL_Rect trect; - if(r+g+b != 0) - { - RGBf(r,g,b); - } point tpoint; if (cent) diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index 2ac68e1e..8bacf44c 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -113,7 +113,7 @@ public: void drawimage(int t, int xp, int yp, bool cent=false); - void drawimagecol(int t, int xp, int yp, int r, int g, int b, bool cent= false); + void drawimagecol(int t, int xp, int yp, bool cent= false); void updatetextboxes(void); void drawgui(void); diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index 121703f4..7bcf52ab 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -433,16 +433,16 @@ static void menurender(void) graphics.Print( -1, 50, "VVVVVV is a game by", tr, tg, tb, true); graphics.bigprint( 40, 65, "Terry Cavanagh", tr, tg, tb, true, 2); - graphics.drawimagecol(7, -1, 86, tr *0.75, tg *0.75, tb *0.75, true); + graphics.drawimagecol(7, -1, 86, true); graphics.Print( -1, 120, "and features music by", tr, tg, tb, true); graphics.bigprint( 40, 135, "Magnus P~lsson", tr, tg, tb, true, 2); - graphics.drawimagecol(8, -1, 156, tr *0.75, tg *0.75, tb *0.75, true); + graphics.drawimagecol(8, -1, 156, true); break; case Menu::credits2: graphics.Print( -1, 50, "Roomnames are by", tr, tg, tb, true); graphics.bigprint( 40, 65, "Bennett Foddy", tr, tg, tb, true); - graphics.drawimagecol(9, -1, 86, tr*0.75, tg *0.75, tb *0.75, true); + graphics.drawimagecol(9, -1, 86, true); graphics.Print( -1, 110, "C++ version by", tr, tg, tb, true); graphics.bigprint( 40, 125, "Simon Roth", tr, tg, tb, true); graphics.bigprint( 40, 145, "Ethan Lee", tr, tg, tb, true);