From df83c2d4949dcd0baf849ccaa97c965824581e16 Mon Sep 17 00:00:00 2001 From: Info Teddy Date: Fri, 24 Jan 2020 20:43:04 -0800 Subject: [PATCH] Add an accessibility option to be able to see through the roomname This is the variable dwgfx.translucentroomname and in unlock.vvv. This lets you see through the black background of the roomname at the bottom of the screen, i.e. it makes the roomname background translucent. So you can see if someone decides to hide pesky spikes there. --- desktop_version/src/Game.cpp | 19 +++++++++++++++---- desktop_version/src/Graphics.cpp | 2 ++ desktop_version/src/Graphics.h | 1 + desktop_version/src/Input.cpp | 6 ++++++ desktop_version/src/editor.cpp | 8 ++++++++ desktop_version/src/titlerender.cpp | 26 ++++++++++++++++++++++++++ 6 files changed, 58 insertions(+), 4 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index ca63357f..b1f76234 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -4443,6 +4443,11 @@ void Game::loadstats( mapclass& map, Graphics& dwgfx ) dwgfx.notextoutline = atoi(pText); } + if (pKey == "translucentroomname") + { + dwgfx.translucentroomname = atoi(pText); + } + if (pKey == "flipButton") { SDL_GameControllerButton newButton; @@ -4656,6 +4661,10 @@ void Game::savestats( mapclass& _map, Graphics& _dwgfx ) msg->LinkEndChild(new TiXmlText(tu.String((int) _dwgfx.notextoutline).c_str())); dataNode->LinkEndChild(msg); + msg = new TiXmlElement("translucentroomname"); + msg->LinkEndChild(new TiXmlText(tu.String((int) _dwgfx.translucentroomname).c_str())); + dataNode->LinkEndChild(msg); + for (size_t i = 0; i < controllerButton_flip.size(); i += 1) { msg = new TiXmlElement("flipButton"); @@ -7042,11 +7051,13 @@ void Game::createmenu( std::string t ) menuoptionsactive[4] = true; menuoptions[5] = "load screen"; menuoptionsactive[5] = true; - menuoptions[6] = "return"; + menuoptions[6] = "room name bg"; menuoptionsactive[6] = true; - nummenuoptions = 7; - menuxoff = -60; - menuyoff = 0; + menuoptions[7] = "return"; + menuoptionsactive[7] = true; + nummenuoptions = 8; + menuxoff = -85; + menuyoff = -10; } else if(t == "controller") { diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 542b8f64..7afc923b 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -122,6 +122,8 @@ Graphics::Graphics() trinketg = 0; trinketb = 0; warprect = SDL_Rect(); + + translucentroomname = false; } Graphics::~Graphics() diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index 44ccc17b..717a79fd 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -277,6 +277,7 @@ public: int warpskip, warpfcol, warpbcol; + bool translucentroomname; }; #endif /* GRAPHICS_H */ diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index c595dd24..91b6ff16 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -746,6 +746,12 @@ SDL_assert(0 && "Remove open level dir"); music.playef(11, 10); } else if (game.currentmenuoption == 6) + { + // toggle translucent roomname BG + dwgfx.translucentroomname = !dwgfx.translucentroomname; + music.playef(11, 10); + } + else if (game.currentmenuoption == 7) { //back music.playef(11, 10); diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index 1a044215..e49063e5 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -3447,6 +3447,14 @@ void editorrender( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map, ent { if(ed.roomnamehide<12) ed.roomnamehide++; } + if (dwgfx.translucentroomname) + { + SDL_SetSurfaceAlphaMod(dwgfx.footerbuffer, 127); + } + else + { + SDL_SetSurfaceAlphaMod(dwgfx.footerbuffer, 255); + } dwgfx.footerrect.y = 230+ed.roomnamehide; SDL_BlitSurface(dwgfx.footerbuffer, NULL, dwgfx.backBuffer, &dwgfx.footerrect); dwgfx.Print(5,231+ed.roomnamehide,ed.level[ed.levx+(ed.maxwidth*ed.levy)].roomname, 196, 196, 255 - help.glow, true); diff --git a/desktop_version/src/titlerender.cpp b/desktop_version/src/titlerender.cpp index 2e2b1a69..ff9ea1ab 100644 --- a/desktop_version/src/titlerender.cpp +++ b/desktop_version/src/titlerender.cpp @@ -553,6 +553,16 @@ void titlerender(Graphics& dwgfx, mapclass& map, Game& game, entityclass& obj, U else dwgfx.Print(-1, 75, "Fake loading screen is ON", tr, tg, tb, true); } + else if (game.currentmenuoption == 6) + { + dwgfx.bigprint(-1, 30, "Room Name BG", tr, tg, tb, true); + dwgfx.Print( -1, 75, "Lets you see through what is behind", tr, tg, tb, true); + dwgfx.Print( -1, 85, "the name at the bottom of the screen.", tr, tg, tb, true); + if (dwgfx.translucentroomname) + dwgfx.Print(-1, 105, "Room name background is TRANSLUCENT", tr/2, tg/2, tb/2, true); + else + dwgfx.Print(-1, 105, "Room name background is OPAQUE", tr, tg, tb, true); + } } else if (game.currentmenuname == "playint1" || game.currentmenuname == "playint2") { @@ -1552,6 +1562,14 @@ void gamerender(Graphics& dwgfx, mapclass& map, Game& game, entityclass& obj, Ut if(map.extrarow==0 || (map.custommode && map.roomname!="")) { + if (dwgfx.translucentroomname) + { + SDL_SetSurfaceAlphaMod(dwgfx.footerbuffer, 127); + } + else + { + SDL_SetSurfaceAlphaMod(dwgfx.footerbuffer, 255); + } dwgfx.footerrect.y = 230; SDL_BlitSurface(dwgfx.footerbuffer, NULL, dwgfx.backBuffer, &dwgfx.footerrect); @@ -2809,6 +2827,14 @@ void towerrender(Graphics& dwgfx, Game& game, mapclass& map, entityclass& obj, U } + if (dwgfx.translucentroomname) + { + SDL_SetSurfaceAlphaMod(dwgfx.footerbuffer, 127); + } + else + { + SDL_SetSurfaceAlphaMod(dwgfx.footerbuffer, 255); + } dwgfx.footerrect.y = 230; SDL_BlitSurface(dwgfx.footerbuffer, NULL, dwgfx.backBuffer, &dwgfx.footerrect); dwgfx.Print(5, 231, map.roomname, 196, 196, 255 - help.glow, true);