diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index c877c83e..be000ad8 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -1002,11 +1002,7 @@ void Graphics::drawgui(void) yp += 2 * (120 - yp) - 8 * (textbox[i].line.size() + 2); } - //This routine also updates textbox colors - float tl_lerp = lerp(textbox[i].prev_tl, textbox[i].tl); - textbox[i].setcol(textbox[i].tr * tl_lerp, textbox[i].tg * tl_lerp, textbox[i].tb * tl_lerp); - - if (textbox[i].tr == 0 && textbox[i].tg == 0 && textbox[i].tb == 0) + if (textbox[i].r == 0 && textbox[i].g == 0 && textbox[i].b == 0) { size_t j; for (j = 0; j < textbox[i].line.size(); j++) @@ -1016,13 +1012,17 @@ void Graphics::drawgui(void) } else { + const float tl_lerp = lerp(textbox[i].prev_tl, textbox[i].tl); + const int r = textbox[i].r * tl_lerp; + const int g = textbox[i].g * tl_lerp; + const int b = textbox[i].b * tl_lerp; size_t j; - drawtextbox(textbox[i].xp, yp, textbox[i].w/8, textbox[i].h/8, textbox[i].r, textbox[i].g, textbox[i].b); + drawtextbox(textbox[i].xp, yp, textbox[i].w/8, textbox[i].h/8, r, g, b); for (j = 0; j < textbox[i].line.size(); j++) { - Print(textbox[i].xp + 8, yp + text_yoff + text_sign * (j * 8), textbox[i].line[j], textbox[i].r, textbox[i].g, textbox[i].b); + Print(textbox[i].xp + 8, yp + text_yoff + text_sign * (j * 8), textbox[i].line[j], r, g, b); } } @@ -1033,7 +1033,7 @@ void Graphics::drawgui(void) continue; } - if (textbox[i].yp == 12 && textbox[i].tr == 165) + if (textbox[i].yp == 12 && textbox[i].r == 165) { if (flipmode) { @@ -1044,7 +1044,7 @@ void Graphics::drawgui(void) drawimage(0, 0, 12, true); } } - else if (textbox[i].yp == 12 && textbox[i].tg == 165) + else if (textbox[i].yp == 12 && textbox[i].g == 165) { if (flipmode) { @@ -1055,27 +1055,27 @@ void Graphics::drawgui(void) drawimage(4, 0, 12, true); } } - if (textbox[i].tr == 175 && textbox[i].tg == 175) + if (textbox[i].r == 175 && textbox[i].g == 175) { //purple guy drawsprite(80 - 6, crew_yp, crew_sprite, 220- help.glow/4 - textbox[i].rand, 120- help.glow/4, 210 - help.glow/4); } - else if (textbox[i].tr == 175 && textbox[i].tb == 175) + else if (textbox[i].r == 175 && textbox[i].b == 175) { //red guy drawsprite(80 - 6, crew_yp, crew_sprite, 255 - help.glow/8, 70 - help.glow/4, 70 - help.glow / 4); } - else if (textbox[i].tr == 175) + else if (textbox[i].r == 175) { //green guy drawsprite(80 - 6, crew_yp, crew_sprite, 120 - help.glow / 4 - textbox[i].rand, 220 - help.glow / 4, 120 - help.glow / 4); } - else if (textbox[i].tg == 175) + else if (textbox[i].g == 175) { //yellow guy drawsprite(80 - 6, crew_yp, crew_sprite, 220- help.glow/4 - textbox[i].rand, 210 - help.glow/4, 120- help.glow/4); } - else if (textbox[i].tb == 175) + else if (textbox[i].b == 175) { //blue guy drawsprite(80 - 6, crew_yp, crew_sprite, 75, 75, 255- help.glow/4 - textbox[i].rand); @@ -1097,11 +1097,11 @@ void Graphics::updatetextboxes(void) } if (textbox[i].tl >= 1.0f - && ((textbox[i].tr == 175 && textbox[i].tg == 175) - || textbox[i].tr == 175 - || textbox[i].tg == 175 - || textbox[i].tb == 175) - && (textbox[i].tr != 175 || textbox[i].tb != 175)) + && ((textbox[i].r == 175 && textbox[i].g == 175) + || textbox[i].r == 175 + || textbox[i].g == 175 + || textbox[i].b == 175) + && (textbox[i].r != 175 || textbox[i].b != 175)) { textbox[i].rand = fRandom() * 20; } diff --git a/desktop_version/src/Textbox.cpp b/desktop_version/src/Textbox.cpp index 092aa997..797a7b3c 100644 --- a/desktop_version/src/Textbox.cpp +++ b/desktop_version/src/Textbox.cpp @@ -16,9 +16,6 @@ textboxclass::textboxclass(void) r = 0; g = 0; b = 0; - tr = 0; - tg = 0; - tb = 0; flipme = false; @@ -49,21 +46,11 @@ void textboxclass::adjust(void) } void textboxclass::initcol(int rr, int gg, int bb) -{ - tr = rr; - tg = gg; - tb = bb; - r = 0; - g = 0; - b = 0; - tl = 0.5; -} - -void textboxclass::setcol(int rr, int gg, int bb) { r = rr; g = gg; b = bb; + tl = 0.5; } void textboxclass::update(void) diff --git a/desktop_version/src/Textbox.h b/desktop_version/src/Textbox.h index b9d1ebf8..f319927e 100644 --- a/desktop_version/src/Textbox.h +++ b/desktop_version/src/Textbox.h @@ -17,8 +17,6 @@ public: void initcol(int rr, int gg, int bb); - void setcol(int rr, int gg, int bb); - void update(void); void remove(void); @@ -33,7 +31,6 @@ public: std::vector line; int xp, yp, w, h; int r,g,b; - int tr,tg,tb; int timer; float tl;