1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 14:38:30 +02:00

Optimization: Don't outline if room name BG opaque

This is quite simple. Just use a function pointer that switches out
which function we're going to use.

...Or not. C++ syntax makes this a bit awful since the function is a
member of a class. Did I mention how much I don't like C++?
This commit is contained in:
Misa 2021-12-25 23:54:43 -08:00
parent 8f226ced84
commit dfb1e31d78

View File

@ -1733,15 +1733,18 @@ void gamerender(void)
if(map.extrarow==0 || (map.custommode && map.roomname[0] != '\0')) if(map.extrarow==0 || (map.custommode && map.roomname[0] != '\0'))
{ {
const char* roomname; const char* roomname;
void (Graphics::*printfunc)(int, int, const std::string&, int, int, int, bool);
graphics.footerrect.y = 230; graphics.footerrect.y = 230;
if (graphics.translucentroomname) if (graphics.translucentroomname)
{ {
SDL_BlitSurface(graphics.footerbuffer, NULL, graphics.backBuffer, &graphics.footerrect); SDL_BlitSurface(graphics.footerbuffer, NULL, graphics.backBuffer, &graphics.footerrect);
printfunc = &Graphics::bprint;
} }
else else
{ {
FillRect(graphics.backBuffer, graphics.footerrect, 0); FillRect(graphics.backBuffer, graphics.footerrect, 0);
printfunc = &Graphics::Print;
} }
if (map.finalmode) if (map.finalmode)
@ -1753,7 +1756,7 @@ void gamerender(void)
roomname = map.roomname; roomname = map.roomname;
} }
graphics.bprint(5, 231, map.roomname, 196, 196, 255 - help.glow, true); (graphics.*printfunc)(5, 231, roomname, 196, 196, 255 - help.glow, true);
} }
if (map.roomtexton) if (map.roomtexton)