1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Unhardcode textbox colors in textbox arguments

There's a few places where textboxes are constructed through code, but
they pass in the color's RGB values in manually. This commit
unhardcodes most of them them, replacing them with a color lookup.

The ones that weren't changed are special cases, like `175, 174, 174`.
This commit is contained in:
AllyTally 2023-03-18 19:11:49 -03:00 committed by Misa Elizabeth Kai
parent bd34af32de
commit efa1bad449
7 changed files with 101 additions and 86 deletions

View file

@ -6,7 +6,6 @@
#include <SDL.h> #include <SDL.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map>
class CustomEntity class CustomEntity
{ {

View file

@ -707,7 +707,7 @@ void Game::remaining_textbox(void)
SDL_strlcpy(buffer, loc::gettext("All Crew Members Rescued!"), sizeof(buffer)); SDL_strlcpy(buffer, loc::gettext("All Crew Members Rescued!"), sizeof(buffer));
} }
graphics.createtextboxflipme(buffer, -1, 128 + 16, 174, 174, 174); graphics.createtextboxflipme(buffer, -1, 128 + 16, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxpad(2, 2); graphics.textboxpad(2, 2);
graphics.textboxcenterx(); graphics.textboxcenterx();
@ -722,7 +722,7 @@ void Game::actionprompt_textbox(void)
"button:but", "button:but",
vformat_button(ActionSet_InGame, Action_InGame_ACTION) vformat_button(ActionSet_InGame, Action_InGame_ACTION)
); );
graphics.createtextboxflipme(buffer, -1, 196, 164, 164, 255); graphics.createtextboxflipme(buffer, -1, 196, TEXT_COLOUR("cyan"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxpad(1, 1); graphics.textboxpad(1, 1);
graphics.textboxcenterx(); graphics.textboxcenterx();
@ -737,7 +737,7 @@ void Game::savetele_textbox(void)
if (savetele()) if (savetele())
{ {
graphics.createtextboxflipme(loc::gettext("Game Saved"), -1, 12, 174, 174, 174); graphics.createtextboxflipme(loc::gettext("Game Saved"), -1, 12, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxpad(3, 3); graphics.textboxpad(3, 3);
graphics.textboxcenterx(); graphics.textboxcenterx();
@ -745,7 +745,7 @@ void Game::savetele_textbox(void)
} }
else else
{ {
graphics.createtextboxflipme(loc::gettext("ERROR: Could not save game!"), -1, 12, 255, 60, 60); graphics.createtextboxflipme(loc::gettext("ERROR: Could not save game!"), -1, 12, TEXT_COLOUR("red"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxwrap(2); graphics.textboxwrap(2);
graphics.textboxpad(1, 1); graphics.textboxpad(1, 1);
@ -833,14 +833,14 @@ void Game::updatestate(void)
advancetext = true; advancetext = true;
hascontrol = false; hascontrol = false;
setstate(3); setstate(3);
graphics.createtextbox("To do: write quick", 50, 80, 164, 164, 255); graphics.createtextbox("To do: write quick", 50, 80, TEXT_COLOUR("cyan"));
graphics.addline("intro to story!"); graphics.addline("intro to story!");
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
//Oh no! what happen to rest of crew etc crash into dimension //Oh no! what happen to rest of crew etc crash into dimension
break; break;
case 4: case 4:
//End of opening cutscene for now //End of opening cutscene for now
graphics.createtextbox(BUTTONGLYPHS_get_wasd_text(), -1, 195, 174, 174, 174); graphics.createtextbox(BUTTONGLYPHS_get_wasd_text(), -1, 195, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxwrap(4); graphics.textboxwrap(4);
graphics.textboxcentertext(); graphics.textboxcentertext();
@ -881,7 +881,7 @@ void Game::updatestate(void)
vformat_button(ActionSet_InGame, Action_InGame_Map) vformat_button(ActionSet_InGame, Action_InGame_Map)
); );
graphics.createtextbox(buffer, -1, 155, 174, 174, 174); graphics.createtextbox(buffer, -1, 155, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxwrap(4); graphics.textboxwrap(4);
graphics.textboxcentertext(); graphics.textboxcentertext();
@ -974,7 +974,7 @@ void Game::updatestate(void)
"floorceiling:str, crewmate:str", "floorceiling:str, crewmate:str",
floorceiling, crewmate floorceiling, crewmate
); );
graphics.createtextbox(loc::gettext(english), -1, 3, 174, 174, 174); graphics.createtextbox(loc::gettext(english), -1, 3, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxwrap(2); graphics.textboxwrap(2);
graphics.textboxpadtowidth(36*8); graphics.textboxpadtowidth(36*8);
@ -1004,7 +1004,7 @@ void Game::updatestate(void)
default: default:
english = "You can't continue to the next room until they are safely across."; english = "You can't continue to the next room until they are safely across.";
} }
graphics.createtextbox(loc::gettext(english), -1, 3, 174, 174, 174); graphics.createtextbox(loc::gettext(english), -1, 3, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxwrap(2); graphics.textboxwrap(2);
graphics.textboxpadtowidth(36*8); graphics.textboxpadtowidth(36*8);
@ -1047,7 +1047,7 @@ void Game::updatestate(void)
"floorceiling:str, crewmate:str", "floorceiling:str, crewmate:str",
floorceiling, crewmate floorceiling, crewmate
); );
graphics.createtextbox(loc::gettext(english), -1, 3, 174, 174, 174); graphics.createtextbox(loc::gettext(english), -1, 3, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxwrap(2); graphics.textboxwrap(2);
graphics.textboxpadtowidth(36*8); graphics.textboxpadtowidth(36*8);
@ -1086,7 +1086,7 @@ void Game::updatestate(void)
obj.removetrigger(17); obj.removetrigger(17);
if (BUTTONGLYPHS_keyboard_is_active()) if (BUTTONGLYPHS_keyboard_is_active())
{ {
graphics.createtextbox(loc::gettext("If you prefer, you can press UP or DOWN instead of ACTION to flip."), -1, 187, 174, 174, 174); graphics.createtextbox(loc::gettext("If you prefer, you can press UP or DOWN instead of ACTION to flip."), -1, 187, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxwrap(2); graphics.textboxwrap(2);
graphics.textboxcentertext(); graphics.textboxcentertext();
@ -1129,7 +1129,7 @@ void Game::updatestate(void)
"button:but", "button:but",
vformat_button(ActionSet_InGame, Action_InGame_ACTION) vformat_button(ActionSet_InGame, Action_InGame_ACTION)
); );
graphics.createtextbox(buffer, -1, 25, 174, 174, 174); graphics.createtextbox(buffer, -1, 25, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxwrap(4); graphics.textboxwrap(4);
graphics.textboxcentertext(); graphics.textboxcentertext();
@ -1475,7 +1475,7 @@ void Game::updatestate(void)
case 50: case 50:
music.playef(15); music.playef(15);
graphics.createtextbox(loc::gettext("Help! Can anyone hear this message?"), 5, 8, 255, 134, 255); graphics.createtextbox(loc::gettext("Help! Can anyone hear this message?"), 5, 8, TEXT_COLOUR("purple"));
graphics.textboxcommsrelay(); graphics.textboxcommsrelay();
graphics.textboxtimer(60); graphics.textboxtimer(60);
incstate(); incstate();
@ -1483,7 +1483,7 @@ void Game::updatestate(void)
break; break;
case 51: case 51:
music.playef(15); music.playef(15);
graphics.createtextbox(loc::gettext("Verdigris? Are you out there? Are you ok?"), 5, 8, 255, 134, 255); graphics.createtextbox(loc::gettext("Verdigris? Are you out there? Are you ok?"), 5, 8, TEXT_COLOUR("purple"));
graphics.textboxcommsrelay(); graphics.textboxcommsrelay();
graphics.textboxtimer(60); graphics.textboxtimer(60);
incstate(); incstate();
@ -1491,7 +1491,7 @@ void Game::updatestate(void)
break; break;
case 52: case 52:
music.playef(15); music.playef(15);
graphics.createtextbox(loc::gettext("Please help us! We've crashed and need assistance!"), 5, 8, 255, 134, 255); graphics.createtextbox(loc::gettext("Please help us! We've crashed and need assistance!"), 5, 8, TEXT_COLOUR("purple"));
graphics.textboxcommsrelay(); graphics.textboxcommsrelay();
graphics.textboxtimer(60); graphics.textboxtimer(60);
incstate(); incstate();
@ -1499,7 +1499,7 @@ void Game::updatestate(void)
break; break;
case 53: case 53:
music.playef(15); music.playef(15);
graphics.createtextbox(loc::gettext("Hello? Anyone out there?"), 5, 8, 255, 134, 255); graphics.createtextbox(loc::gettext("Hello? Anyone out there?"), 5, 8, TEXT_COLOUR("purple"));
graphics.textboxcommsrelay(); graphics.textboxcommsrelay();
graphics.textboxtimer(60); graphics.textboxtimer(60);
incstate(); incstate();
@ -1507,7 +1507,7 @@ void Game::updatestate(void)
break; break;
case 54: case 54:
music.playef(15); music.playef(15);
graphics.createtextbox(loc::gettext("This is Doctor Violet from the D.S.S. Souleye! Please respond!"), 5, 8, 255, 134, 255); graphics.createtextbox(loc::gettext("This is Doctor Violet from the D.S.S. Souleye! Please respond!"), 5, 8, TEXT_COLOUR("purple"));
graphics.textboxcommsrelay(); graphics.textboxcommsrelay();
graphics.textboxtimer(60); graphics.textboxtimer(60);
incstate(); incstate();
@ -1515,7 +1515,7 @@ void Game::updatestate(void)
break; break;
case 55: case 55:
music.playef(15); music.playef(15);
graphics.createtextbox(loc::gettext("Please... Anyone..."), 5, 8, 255, 134, 255); graphics.createtextbox(loc::gettext("Please... Anyone..."), 5, 8, TEXT_COLOUR("purple"));
graphics.textboxcommsrelay(); graphics.textboxcommsrelay();
graphics.textboxtimer(60); graphics.textboxtimer(60);
incstate(); incstate();
@ -1523,7 +1523,7 @@ void Game::updatestate(void)
break; break;
case 56: case 56:
music.playef(15); music.playef(15);
graphics.createtextbox(loc::gettext("Please be alright, everyone..."), 5, 8, 255, 134, 255); graphics.createtextbox(loc::gettext("Please be alright, everyone..."), 5, 8, TEXT_COLOUR("purple"));
graphics.textboxcommsrelay(); graphics.textboxcommsrelay();
graphics.textboxtimer(60); graphics.textboxtimer(60);
setstate(50); setstate(50);
@ -1748,7 +1748,7 @@ void Game::updatestate(void)
} }
break; break;
case 104: case 104:
graphics.createtextbox("I'm glad you're ok!", 135, 152, 164, 164, 255); graphics.createtextbox("I'm glad you're ok!", 135, 152, TEXT_COLOUR("cyan"));
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
incstate(); incstate();
music.playef(11); music.playef(11);
@ -1772,7 +1772,7 @@ void Game::updatestate(void)
} }
break; break;
case 108: case 108:
graphics.createtextbox("Don't worry! I have a", 125, 152, 164, 164, 255); graphics.createtextbox("Don't worry! I have a", 125, 152, TEXT_COLOUR("cyan"));
graphics.addline("teleporter key!"); graphics.addline("teleporter key!");
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
incstate(); incstate();
@ -1788,7 +1788,7 @@ void Game::updatestate(void)
obj.entities[i].tile = 0; obj.entities[i].tile = 0;
obj.entities[i].state = 1; obj.entities[i].state = 1;
} }
graphics.createtextbox("Follow me!", 185, 154, 164, 164, 255); graphics.createtextbox("Follow me!", 185, 154, TEXT_COLOUR("cyan"));
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
incstate(); incstate();
music.playef(11); music.playef(11);
@ -1870,7 +1870,7 @@ void Game::updatestate(void)
advancetext = true; advancetext = true;
hascontrol = false; hascontrol = false;
graphics.createtextbox("Captain! You're ok!", 60-10, 90-40, 255, 255, 134); graphics.createtextbox("Captain! You're ok!", 60-10, 90-40, TEXT_COLOUR("yellow"));
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
incstate(); incstate();
music.playef(14); music.playef(14);
@ -1878,7 +1878,7 @@ void Game::updatestate(void)
} }
case 124: case 124:
{ {
graphics.createtextbox("I've found a teleporter, but", 60-20, 90 - 40, 255, 255, 134); graphics.createtextbox("I've found a teleporter, but", 60-20, 90 - 40, TEXT_COLOUR("yellow"));
graphics.addline("I can't get it to go anywhere..."); graphics.addline("I can't get it to go anywhere...");
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
incstate(); incstate();
@ -1887,14 +1887,14 @@ void Game::updatestate(void)
break; break;
} }
case 126: case 126:
graphics.createtextbox("I can help with that!", 125, 152-40, 164, 164, 255); graphics.createtextbox("I can help with that!", 125, 152-40, TEXT_COLOUR("cyan"));
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
incstate(); incstate();
music.playef(11); music.playef(11);
graphics.textboxactive(); graphics.textboxactive();
break; break;
case 128: case 128:
graphics.createtextbox("I have the teleporter", 130, 152-35, 164, 164, 255); graphics.createtextbox("I have the teleporter", 130, 152-35, TEXT_COLOUR("cyan"));
graphics.addline("codex for our ship!"); graphics.addline("codex for our ship!");
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
incstate(); incstate();
@ -1904,7 +1904,7 @@ void Game::updatestate(void)
case 130: case 130:
{ {
graphics.createtextbox("Yey! Let's go home!", 60-30, 90-35, 255, 255, 134); graphics.createtextbox("Yey! Let's go home!", 60-30, 90-35, TEXT_COLOUR("yellow"));
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
incstate(); incstate();
music.playef(14); music.playef(14);
@ -2003,7 +2003,7 @@ void Game::updatestate(void)
//Found a trinket! //Found a trinket!
advancetext = true; advancetext = true;
incstate(); incstate();
graphics.createtextboxflipme(loc::gettext("Congratulations!\n\nYou have found a shiny trinket!"), 50, 85, 174, 174, 174); graphics.createtextboxflipme(loc::gettext("Congratulations!\n\nYou have found a shiny trinket!"), 50, 85, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
int h = graphics.textboxwrap(2); int h = graphics.textboxwrap(2);
graphics.textboxcentertext(); graphics.textboxcentertext();
@ -2030,7 +2030,7 @@ void Game::updatestate(void)
"n_trinkets:int, max_trinkets:int", "n_trinkets:int, max_trinkets:int",
trinkets(), max_trinkets trinkets(), max_trinkets
); );
graphics.createtextboxflipme(buffer, 50, 95+h, 174, 174, 174); graphics.createtextboxflipme(buffer, 50, 95+h, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxwrap(2); graphics.textboxwrap(2);
graphics.textboxcentertext(); graphics.textboxcentertext();
@ -2071,7 +2071,7 @@ void Game::updatestate(void)
//Found a crewmate! //Found a crewmate!
advancetext = true; advancetext = true;
incstate(); incstate();
graphics.createtextboxflipme(loc::gettext("Congratulations!\n\nYou have found a lost crewmate!"), 50, 85, 174, 174, 174); graphics.createtextboxflipme(loc::gettext("Congratulations!\n\nYou have found a lost crewmate!"), 50, 85, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
int h = graphics.textboxwrap(2); int h = graphics.textboxwrap(2);
graphics.textboxcentertext(); graphics.textboxcentertext();
@ -2080,7 +2080,7 @@ void Game::updatestate(void)
if(cl.numcrewmates()-crewmates()==0) if(cl.numcrewmates()-crewmates()==0)
{ {
graphics.createtextboxflipme(loc::gettext("All crewmates rescued!"), 50, 95+h, 174, 174, 174); graphics.createtextboxflipme(loc::gettext("All crewmates rescued!"), 50, 95+h, TEXT_COLOUR("gray"));
} }
else else
{ {
@ -2091,7 +2091,7 @@ void Game::updatestate(void)
"n_crew:int", "n_crew:int",
cl.numcrewmates()-crewmates() cl.numcrewmates()-crewmates()
); );
graphics.createtextboxflipme(buffer, 50, 95+h, 174, 174, 174); graphics.createtextboxflipme(buffer, 50, 95+h, TEXT_COLOUR("gray"));
} }
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxwrap(4); graphics.textboxwrap(4);
@ -2299,7 +2299,7 @@ void Game::updatestate(void)
case 2510: case 2510:
advancetext = true; advancetext = true;
hascontrol = false; hascontrol = false;
graphics.createtextbox("Hello?", 125+24, 152-20, 164, 164, 255); graphics.createtextbox("Hello?", 125+24, 152-20, TEXT_COLOUR("cyan"));
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
incstate(); incstate();
music.playef(11); music.playef(11);
@ -2308,7 +2308,7 @@ void Game::updatestate(void)
case 2512: case 2512:
advancetext = true; advancetext = true;
hascontrol = false; hascontrol = false;
graphics.createtextbox("Is anyone there?", 125+8, 152-24, 164, 164, 255); graphics.createtextbox("Is anyone there?", 125+8, 152-24, TEXT_COLOUR("cyan"));
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
incstate(); incstate();
music.playef(11); music.playef(11);
@ -2849,7 +2849,7 @@ void Game::updatestate(void)
incstate(); incstate();
setstatedelay(45+15); setstatedelay(45+15);
graphics.createtextboxflipme(loc::gettext("All Crew Members Rescued!"), -1, 64, 0, 0, 0); graphics.createtextboxflipme(loc::gettext("All Crew Members Rescued!"), -1, 64, TEXT_COLOUR("transparent"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
char buffer[SCREEN_WIDTH_CHARS + 1]; char buffer[SCREEN_WIDTH_CHARS + 1];
timestringcenti(buffer, sizeof(buffer)); timestringcenti(buffer, sizeof(buffer));
@ -2868,9 +2868,9 @@ void Game::updatestate(void)
"gamecomplete_n_trinkets:int", "gamecomplete_n_trinkets:int",
trinkets() trinkets()
); );
graphics.createtextboxflipme(label, 168-font::len(PR_FONT_INTERFACE, label), 84, 0,0,0); graphics.createtextboxflipme(label, 168-font::len(PR_FONT_INTERFACE, label), 84, TEXT_COLOUR("transparent"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.createtextboxflipme(buffer, 180, 84, 0, 0, 0); graphics.createtextboxflipme(buffer, 180, 84, TEXT_COLOUR("transparent"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
break; break;
} }
@ -2881,9 +2881,9 @@ void Game::updatestate(void)
const char* label = loc::gettext("Game Time:"); const char* label = loc::gettext("Game Time:");
std::string tempstring = savetime; std::string tempstring = savetime;
graphics.createtextboxflipme(label, 168-font::len(PR_FONT_INTERFACE, label), 96, 0,0,0); graphics.createtextboxflipme(label, 168-font::len(PR_FONT_INTERFACE, label), 96, TEXT_COLOUR("transparent"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.createtextboxflipme(tempstring, 180, 96, 0, 0, 0); graphics.createtextboxflipme(tempstring, 180, 96, TEXT_COLOUR("transparent"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
break; break;
} }
@ -2893,9 +2893,9 @@ void Game::updatestate(void)
setstatedelay(45); setstatedelay(45);
const char* label = loc::gettext("Total Flips:"); const char* label = loc::gettext("Total Flips:");
graphics.createtextboxflipme(label, 168-font::len(PR_FONT_INTERFACE, label), 123, 0,0,0); graphics.createtextboxflipme(label, 168-font::len(PR_FONT_INTERFACE, label), 123, TEXT_COLOUR("transparent"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.createtextboxflipme(help.String(totalflips), 180, 123, 0, 0, 0); graphics.createtextboxflipme(help.String(totalflips), 180, 123, TEXT_COLOUR("transparent"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
break; break;
} }
@ -2905,9 +2905,9 @@ void Game::updatestate(void)
setstatedelay(45+15); setstatedelay(45+15);
const char* label = loc::gettext("Total Deaths:"); const char* label = loc::gettext("Total Deaths:");
graphics.createtextboxflipme(label, 168-font::len(PR_FONT_INTERFACE, label), 135, 0,0,0); graphics.createtextboxflipme(label, 168-font::len(PR_FONT_INTERFACE, label), 135, TEXT_COLOUR("transparent"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.createtextboxflipme(help.String(deathcounts), 180, 135, 0, 0, 0); graphics.createtextboxflipme(help.String(deathcounts), 180, 135, TEXT_COLOUR("transparent"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
break; break;
} }
@ -2924,9 +2924,9 @@ void Game::updatestate(void)
"n_deaths:int", "n_deaths:int",
hardestroomdeaths hardestroomdeaths
); );
graphics.createtextboxflipme(buffer, -1, 158, 0,0,0); graphics.createtextboxflipme(buffer, -1, 158, TEXT_COLOUR("transparent"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.createtextboxflipme(hardestroom, -1, 170, 0, 0, 0); graphics.createtextboxflipme(hardestroom, -1, 170, TEXT_COLOUR("transparent"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
break; break;
} }

View file

@ -18,6 +18,7 @@
#include "Music.h" #include "Music.h"
#include "RoomnameTranslator.h" #include "RoomnameTranslator.h"
#include "Screen.h" #include "Screen.h"
#include "Script.h"
#include "UtilityClass.h" #include "UtilityClass.h"
#include "VFormat.h" #include "VFormat.h"
#include "Vlogging.h" #include "Vlogging.h"
@ -929,7 +930,8 @@ void Graphics::drawgui(void)
{ {
y = 240 - y - 8*sc; y = 240 - y - 8*sc;
} }
font::print((sc==2 ? PR_2X : PR_1X) | PR_CEN, -1, y, translation, 164, 164, 255); SDL_Color color = TEXT_COLOUR("cyan");
font::print((sc==2 ? PR_2X : PR_1X) | PR_CEN, -1, y, translation, color.r, color.g, color.b);
} }
else else
{ {
@ -1420,11 +1422,8 @@ void Graphics::textboxadjust(void)
void Graphics::createtextboxreal( void Graphics::createtextboxreal(
const std::string& t, const std::string& t,
int xp, int xp, int yp,
int yp, int r, int g, int b,
int r,
int g,
int b,
bool flipme bool flipme
) { ) {
m = textboxes.size(); m = textboxes.size();
@ -1445,22 +1444,32 @@ void Graphics::createtextboxreal(
void Graphics::createtextbox( void Graphics::createtextbox(
const std::string& t, const std::string& t,
int xp, int xp, int yp,
int yp, SDL_Color color
int r, ) {
int g, createtextboxreal(t, xp, yp, color.r, color.g, color.b, false);
int b }
void Graphics::createtextbox(
const std::string& t,
int xp, int yp,
int r, int g, int b
) { ) {
createtextboxreal(t, xp, yp, r, g, b, false); createtextboxreal(t, xp, yp, r, g, b, false);
} }
void Graphics::createtextboxflipme( void Graphics::createtextboxflipme(
const std::string& t, const std::string& t,
int xp, int xp, int yp,
int yp, SDL_Color color
int r, ) {
int g, createtextboxreal(t, xp, yp, color.r, color.g, color.b, true);
int b }
void Graphics::createtextboxflipme(
const std::string& t,
int xp, int yp,
int r, int g, int b
) { ) {
createtextboxreal(t, xp, yp, r, g, b, true); createtextboxreal(t, xp, yp, r, g, b, true);
} }

View file

@ -69,28 +69,29 @@ public:
void createtextboxreal( void createtextboxreal(
const std::string& t, const std::string& t,
int xp, int xp, int yp,
int yp, int r, int g, int b,
int r,
int g,
int b,
bool flipme bool flipme
); );
void createtextbox( void createtextbox(
const std::string& t, const std::string& t,
int xp, int xp, int yp,
int yp, SDL_Color color
int r, );
int g, void createtextbox(
int b const std::string& t,
int xp, int yp,
int r, int g, int b
); );
void createtextboxflipme( void createtextboxflipme(
const std::string& t, const std::string& t,
int xp, int xp, int yp,
int yp, SDL_Color color
int r, );
int g, void createtextboxflipme(
int b const std::string& t,
int xp, int yp,
int r, int g, int b
); );
void textboxcenterx(void); void textboxcenterx(void);

View file

@ -9,6 +9,7 @@
#include "Localization.h" #include "Localization.h"
#include "LocalizationMaint.h" #include "LocalizationMaint.h"
#include "Map.h" #include "Map.h"
#include "Script.h"
#include "UtilityClass.h" #include "UtilityClass.h"
#include "VFormat.h" #include "VFormat.h"
@ -252,14 +253,14 @@ namespace roomname_translator
{ {
if (loc::save_roomname_explanation_to_files(map.custommode, game.roomx, game.roomy, explanation)) if (loc::save_roomname_explanation_to_files(map.custommode, game.roomx, game.roomy, explanation))
{ {
graphics.createtextboxflipme(success_message, -1, 176, 174, 174, 174); graphics.createtextboxflipme(success_message, -1, 176, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
graphics.textboxcenterx(); graphics.textboxcenterx();
graphics.textboxtimer(25); graphics.textboxtimer(25);
} }
else else
{ {
graphics.createtextboxflipme("ERROR: Could not save to all langs!", -1, 176, 255, 60, 60); graphics.createtextboxflipme("ERROR: Could not save to all langs!", -1, 176, TEXT_COLOUR("red"));
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
graphics.textboxcenterx(); graphics.textboxcenterx();
graphics.textboxtimer(50); graphics.textboxtimer(50);
@ -270,14 +271,14 @@ namespace roomname_translator
{ {
if (loc::save_roomname_to_file(loc::lang, map.custommode, game.roomx, game.roomy, translation, NULL)) if (loc::save_roomname_to_file(loc::lang, map.custommode, game.roomx, game.roomy, translation, NULL))
{ {
graphics.createtextboxflipme("Translation saved!", -1, 176, 174, 174, 174); graphics.createtextboxflipme("Translation saved!", -1, 176, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
graphics.textboxcenterx(); graphics.textboxcenterx();
graphics.textboxtimer(25); graphics.textboxtimer(25);
} }
else else
{ {
graphics.createtextboxflipme("ERROR: Could not save!", -1, 144, 255, 60, 60); graphics.createtextboxflipme("ERROR: Could not save!", -1, 144, TEXT_COLOUR("red"));
graphics.addline(""); graphics.addline("");
graphics.addline("1) Do the language files exist?"); graphics.addline("1) Do the language files exist?");
graphics.addline("2) Make sure there is no \"lang\""); graphics.addline("2) Make sure there is no \"lang\"");
@ -341,7 +342,7 @@ namespace roomname_translator
{ {
if (loc::lang == "en") if (loc::lang == "en")
{ {
graphics.createtextboxflipme("ERROR: Can't add EN-EN translation", -1, 176, 255, 60, 60); graphics.createtextboxflipme("ERROR: Can't add EN-EN translation", -1, 176, TEXT_COLOUR("red"));
graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxprintflags(PR_FONT_8X8);
graphics.textboxcenterx(); graphics.textboxcenterx();
graphics.textboxtimer(50); graphics.textboxtimer(50);

View file

@ -57,6 +57,7 @@ scriptclass::scriptclass(void)
void scriptclass::add_default_colours(void) void scriptclass::add_default_colours(void)
{ {
textbox_colours["player"] = graphics.getRGB(164, 164, 255);
textbox_colours["cyan"] = graphics.getRGB(164, 164, 255); textbox_colours["cyan"] = graphics.getRGB(164, 164, 255);
textbox_colours["red"] = graphics.getRGB(255, 60, 60); textbox_colours["red"] = graphics.getRGB(255, 60, 60);
textbox_colours["green"] = graphics.getRGB(144, 255, 144); textbox_colours["green"] = graphics.getRGB(144, 255, 144);
@ -1742,7 +1743,7 @@ void scriptclass::run(void)
graphics.textboxremovefast(); graphics.textboxremovefast();
graphics.createtextboxflipme(loc::gettext("Congratulations!\n\nYou have found a shiny trinket!"), 50, 85, 174, 174, 174); graphics.createtextboxflipme(loc::gettext("Congratulations!\n\nYou have found a shiny trinket!"), 50, 85, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
int h = graphics.textboxwrap(2); int h = graphics.textboxwrap(2);
graphics.textboxcentertext(); graphics.textboxcentertext();
@ -1769,7 +1770,7 @@ void scriptclass::run(void)
"n_trinkets:int, max_trinkets:int", "n_trinkets:int, max_trinkets:int",
game.trinkets(), max_trinkets game.trinkets(), max_trinkets
); );
graphics.createtextboxflipme(buffer, 50, 95+h, 174, 174, 174); graphics.createtextboxflipme(buffer, 50, 95+h, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxwrap(2); graphics.textboxwrap(2);
graphics.textboxcentertext(); graphics.textboxcentertext();
@ -1792,7 +1793,7 @@ void scriptclass::run(void)
graphics.textboxremovefast(); graphics.textboxremovefast();
graphics.createtextbox(loc::gettext("Congratulations!\n\nYou have found the secret lab!"), 50, 85, 174, 174, 174); graphics.createtextbox(loc::gettext("Congratulations!\n\nYou have found the secret lab!"), 50, 85, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxwrap(2); graphics.textboxwrap(2);
graphics.textboxcentertext(); graphics.textboxcentertext();
@ -1814,7 +1815,7 @@ void scriptclass::run(void)
{ {
graphics.textboxremovefast(); graphics.textboxremovefast();
graphics.createtextbox(loc::gettext("The secret lab is separate from the rest of the game. You can now come back here at any time by selecting the new SECRET LAB option in the play menu."), 50, 85, 174, 174, 174); graphics.createtextbox(loc::gettext("The secret lab is separate from the rest of the game. You can now come back here at any time by selecting the new SECRET LAB option in the play menu."), 50, 85, TEXT_COLOUR("gray"));
graphics.textboxprintflags(PR_FONT_INTERFACE); graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxwrap(0); graphics.textboxwrap(0);
graphics.textboxcenterx(); graphics.textboxcenterx();

View file

@ -9,7 +9,11 @@
#define filllines(lines) commands.insert(commands.end(), lines, lines + SDL_arraysize(lines)) #define filllines(lines) commands.insert(commands.end(), lines, lines + SDL_arraysize(lines))
#ifdef SCRIPT_DEFINITION
#define TEXT_COLOUR(a) textbox_colours[a]
#else
#define TEXT_COLOUR(a) script.textbox_colours[a] #define TEXT_COLOUR(a) script.textbox_colours[a]
#endif
struct Script struct Script
{ {