diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 9aea960387..0e103645b8 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -695,12 +695,13 @@ void Game::savecustomlevelstats(void) void Game::levelcomplete_textbox(void) { - graphics.createtextboxflipme("", -1, 12, 165, 165, 255); + graphics.createtextboxflipme("", -1, 12, TEXT_COLOUR("cyan")); graphics.addline(" "); graphics.addline(""); graphics.addline(""); graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxcenterx(); + graphics.setimage(TEXTIMAGE_LEVELCOMPLETE); } void Game::crewmate_textbox(const int color) @@ -2901,12 +2902,13 @@ void Game::updatestate(void) setstatedelay(75); music.play(Music_PLENARY); - graphics.createtextboxflipme("", -1, 12, 164, 165, 255); + graphics.createtextboxflipme("", -1, 12, TEXT_COLOUR("cyan")); graphics.addline(" "); graphics.addline(""); graphics.addline(""); graphics.textboxprintflags(PR_FONT_8X8); graphics.textboxcenterx(); + graphics.setimage(TEXTIMAGE_GAMECOMPLETE); break; case 3502: { diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 0bbf2520a3..755268d0b7 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -883,7 +883,7 @@ void Graphics::drawgui(void) continue; } - if (textboxes[i].yp == 12 && textboxes[i].r == 165) + if (textboxes[i].image == TEXTIMAGE_LEVELCOMPLETE) { // Level complete const char* english = "Level Complete!"; @@ -920,7 +920,7 @@ void Graphics::drawgui(void) } } } - else if (textboxes[i].yp == 12 && textboxes[i].g == 165) + else if (textboxes[i].image == TEXTIMAGE_GAMECOMPLETE) { // Game complete const char* english = "Game Complete!"; @@ -1369,6 +1369,17 @@ void Graphics::addsprite(int x, int y, int tile, int col) textboxes[m].addsprite(x, y, tile, col); } +void Graphics::setimage(TextboxImage image) +{ + if (!INBOUNDS_VEC(m, textboxes)) + { + vlog_error("setimage() out-of-bounds!"); + return; + } + + textboxes[m].setimage(image); +} + void Graphics::addline( const std::string& t ) { if (!INBOUNDS_VEC(m, textboxes)) diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index 130799a8a8..593163348d 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -124,6 +124,8 @@ class Graphics void addsprite(int x, int y, int tile, int col); + void setimage(TextboxImage image); + void textboxremove(void); void textboxremovefast(void); diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index 44d86fc5c3..68ff79c4cc 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -55,6 +55,7 @@ scriptclass::scriptclass(void) textbuttons = false; textlarge = false; textbox_sprites.clear(); + textbox_image = TEXTIMAGE_NONE; } void scriptclass::add_default_colours(void) @@ -507,6 +508,7 @@ void scriptclass::run(void) textpadtowidth = 0; textboxtimer = 0; textbox_sprites.clear(); + textbox_image = TEXTIMAGE_NONE; translate_dialogue(); } @@ -686,6 +688,21 @@ void scriptclass::run(void) sprite.col = ss_toi(words[4]); textbox_sprites.push_back(sprite); } + else if (words[0] == "textimage") + { + if (words[1] == "levelcomplete") + { + textbox_image = TEXTIMAGE_LEVELCOMPLETE; + } + else if (words[1] == "gamecomplete") + { + textbox_image = TEXTIMAGE_GAMECOMPLETE; + } + else + { + textbox_image = TEXTIMAGE_NONE; + } + } else if (words[0] == "flipme") { textflipme = !textflipme; @@ -722,6 +739,8 @@ void scriptclass::run(void) graphics.addsprite(textbox_sprites[i].x, textbox_sprites[i].y, textbox_sprites[i].tile, textbox_sprites[i].col); } + graphics.setimage(textbox_image); + // Some textbox formatting that can be set by translations... if (textcentertext) { diff --git a/desktop_version/src/Script.h b/desktop_version/src/Script.h index 6bc19715bb..bf9f8d9798 100644 --- a/desktop_version/src/Script.h +++ b/desktop_version/src/Script.h @@ -125,6 +125,7 @@ class scriptclass bool textlarge; int textboxtimer; std::vector textbox_sprites; + TextboxImage textbox_image; //Misc int i, j, k; diff --git a/desktop_version/src/Textbox.cpp b/desktop_version/src/Textbox.cpp index 1546b42575..a538f35f52 100644 --- a/desktop_version/src/Textbox.cpp +++ b/desktop_version/src/Textbox.cpp @@ -30,6 +30,8 @@ textboxclass::textboxclass(void) fill_buttons = false; sprites.clear(); + + image = TEXTIMAGE_NONE; } void textboxclass::addsprite(int x, int y, int tile, int col) @@ -42,6 +44,11 @@ void textboxclass::addsprite(int x, int y, int tile, int col) sprites.push_back(sprite); } +void textboxclass::setimage(TextboxImage new_image) +{ + image = new_image; +} + void textboxclass::centerx(void) { resize(); diff --git a/desktop_version/src/Textbox.h b/desktop_version/src/Textbox.h index 92da145d54..4f4a927e5c 100644 --- a/desktop_version/src/Textbox.h +++ b/desktop_version/src/Textbox.h @@ -13,6 +13,13 @@ struct TextboxSprite int tile; }; +enum TextboxImage +{ + TEXTIMAGE_NONE, + TEXTIMAGE_LEVELCOMPLETE, + TEXTIMAGE_GAMECOMPLETE +}; + class textboxclass { public: @@ -20,6 +27,8 @@ class textboxclass void addsprite(int x, int y, int tile, int col); + void setimage(TextboxImage image); + void centerx(void); void centery(void); @@ -65,6 +74,7 @@ class textboxclass bool fill_buttons; std::vector sprites; + TextboxImage image; }; #endif /* TEXTBOX_H */