diff --git a/desktop_version/src/Credits.h b/desktop_version/src/Credits.h index eb1b2552..1168d285 100644 --- a/desktop_version/src/Credits.h +++ b/desktop_version/src/Credits.h @@ -58,6 +58,9 @@ static const char* translators[] = { " Sound of Mystery / craft", }; +/* Hardcoded pagesizes for the translator credits. Simplifies paging backwards and forwards */ +static const int translator_pagesize[] = { 8, 9, 8, 10, 10, 4 }; + /* Terry's Patrons... */ static const char* superpatrons[] = { "Anders Ekermo", @@ -174,7 +177,7 @@ static const char* githubfriends[] = { }; /* Calculate credits length, finally. */ -static const int creditmaxposition = 1228 + (10 * ( +static const int creditmaxposition = 1348 + (10 * ( SDL_arraysize(superpatrons) + SDL_arraysize(patrons) + SDL_arraysize(githubfriends) )) + (12 * SDL_arraysize(translators)); diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 8d5ea50e..24209e23 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -242,6 +242,7 @@ void Game::init(void) currentmenuoption = 0; menutestmode = false; current_credits_list_index = 0; + translator_credits_pagenum = 0; menuxoff = 0; menuyoff = 0; menucountdown = 0; @@ -6703,6 +6704,8 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ ) case Menu::credits3: case Menu::credits4: case Menu::credits5: + case Menu::credits_localisations_implementation: + case Menu::credits_localisations_translations: option(loc::gettext("next page")); option(loc::gettext("previous page")); option(loc::gettext("return")); diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index 96ed0e15..c35cfbd4 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -85,6 +85,8 @@ namespace Menu credits4, credits5, credits6, + credits_localisations_implementation, + credits_localisations_translations, play, unlocktimetrial, unlocktimetrials, @@ -375,6 +377,7 @@ public: enum Menu::MenuName kludge_ingametemp; enum SLIDERMODE slidermode; int current_credits_list_index; + int translator_credits_pagenum; int menuxoff, menuyoff; int menuspacing; std::vector menustack; diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index 64ea78ca..e964264b 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -1567,7 +1567,7 @@ static void menuactionpress(void) case 0: //next page music.playef(Sound_VIRIDIAN); - game.createmenu(Menu::credits3, true); + game.createmenu(Menu::credits_localisations_implementation, true); map.nexttowercolour(); break; case 1: @@ -1584,6 +1584,87 @@ static void menuactionpress(void) break; } break; + case Menu::credits_localisations_implementation: + switch (game.currentmenuoption) + { + case 0: + //next page + music.playef(Sound_VIRIDIAN); + game.translator_credits_pagenum = 0; + game.createmenu(Menu::credits_localisations_translations, true); + map.nexttowercolour(); + break; + case 1: + //previous page + music.playef(Sound_VIRIDIAN); + game.createmenu(Menu::credits25, true); + map.nexttowercolour(); + break; + default: + //back + music.playef(Sound_VIRIDIAN); + game.returnmenu(); + map.nexttowercolour(); + break; + } + break; + case Menu::credits_localisations_translations: + switch (game.currentmenuoption) + { + case 0: + //next page + music.playef(Sound_VIRIDIAN); + game.translator_credits_pagenum++; + + if (game.translator_credits_pagenum >= (int)SDL_arraysize(Credits::translator_pagesize)) + { + // No more translators. Move to the next credits section + game.current_credits_list_index = 0; + game.createmenu(Menu::credits3, true); + } + else + { + // There are more translators. Refresh the menu with the next ones + game.current_credits_list_index = 0; + for (int i = 0; i < game.translator_credits_pagenum; i += 1) + { + game.current_credits_list_index += Credits::translator_pagesize[i]; + } + + game.createmenu(Menu::credits_localisations_translations, true); + } + + map.nexttowercolour(); + break; + case 1: + //previous page + music.playef(Sound_VIRIDIAN); + game.translator_credits_pagenum--; + if (game.translator_credits_pagenum >= 0) + { + game.current_credits_list_index = 0; + for (int i = 0; i < game.translator_credits_pagenum; i += 1) + { + game.current_credits_list_index += Credits::translator_pagesize[i]; + } + game.createmenu(Menu::credits_localisations_translations, true); + }else { + //No more translators. Move to the previous credits section + game.current_credits_list_index = 0; + game.createmenu(Menu::credits_localisations_implementation, true); + } + + map.nexttowercolour(); + break; + default: + //back + music.playef(Sound_VIRIDIAN); + game.current_credits_list_index = 0; + game.returnmenu(); + map.nexttowercolour(); + break; + } + break; case Menu::credits3: switch (game.currentmenuoption) { @@ -1614,8 +1695,13 @@ static void menuactionpress(void) if (game.current_credits_list_index < 0) { //No more super patrons. Move to the previous credits section + game.translator_credits_pagenum = (int)SDL_arraysize(Credits::translator_pagesize) - 1; game.current_credits_list_index = 0; - game.createmenu(Menu::credits25, true); + for (int i = 0; i < game.translator_credits_pagenum; i += 1) + { + game.current_credits_list_index += Credits::translator_pagesize[i]; + } + game.createmenu(Menu::credits_localisations_translations, true); } else { diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index a0854c5f..3af58f38 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -533,13 +533,13 @@ static void menurender(void) graphics.drawimagecol(IMAGE_SITE2, -1, 156, graphics.getRGB(tr, tg, tb), true); break; case Menu::credits2: - font::print(PR_CEN, -1, 50, loc::gettext("Roomnames are by"), tr, tg, tb); - font::print(PR_2X | PR_CEN | PR_FONT_8X8, -1, 65, "Bennett Foddy", tr, tg, tb); - graphics.drawimagecol(IMAGE_SITE3, -1, 86, graphics.getRGB(tr, tg, tb), true); - font::print(PR_CEN, -1, 110, loc::gettext("C++ version by"), tr, tg, tb); - font::print(PR_2X | PR_CEN | PR_FONT_8X8, -1, 125, "Simon Roth", tr, tg, tb); - font::print(PR_2X | PR_CEN | PR_FONT_8X8, -1, 145, "Ethan Lee", tr, tg, tb); - font::print(PR_2X | PR_CEN | PR_FONT_8X8, -1, 165, "Misa Kai", tr, tg, tb); + font::print(PR_CEN, -1, 40, loc::gettext("Roomnames are by"), tr, tg, tb); + font::print(PR_2X | PR_CEN | PR_FONT_8X8, -1, 55, "Bennett Foddy", tr, tg, tb); + graphics.drawimagecol(IMAGE_SITE3, -1, 76, graphics.getRGB(tr, tg, tb), true); + font::print(PR_CEN, -1, 100, loc::gettext("C++ version by"), tr, tg, tb); + font::print(PR_2X | PR_CEN | PR_FONT_8X8, -1, 115, "Simon Roth", tr, tg, tb); + font::print(PR_2X | PR_CEN | PR_FONT_8X8, -1, 135, "Ethan Lee", tr, tg, tb); + font::print(PR_2X | PR_CEN | PR_FONT_8X8, -1, 155, "Misa Kai", tr, tg, tb); break; case Menu::credits25: font::print(PR_CEN, -1, 40, loc::gettext("Beta Testing by"), tr, tg, tb); @@ -548,6 +548,44 @@ static void menurender(void) font::print(PR_CEN, -1, 130, loc::gettext("Ending Picture by"), tr, tg, tb); font::print(PR_2X | PR_CEN | PR_FONT_8X8, -1, 145, "Pauli Kohberger", tr, tg, tb); break; + case Menu::credits_localisations_implementation: + font::print(PR_CEN, -1, 30, loc::gettext("Localisation Project Led by"), tr, tg, tb); + font::print(PR_2X | PR_CEN | PR_FONT_8X8, -1, 45, "Dav999", tr, tg, tb); + font::print(PR_CEN, -1, 75, loc::gettext("Pan-European Font Design by"), tr, tg, tb); + font::print(PR_2X | PR_CEN | PR_FONT_8X8, -1, 90, "Reese Rivers", tr, tg, tb); + font::print_wrap(PR_CEN, -1, 125, loc::gettext("With contributions on GitHub from"), tr, tg, tb); + font::print(PR_2X | PR_CEN | PR_FONT_8X8, -1, 140, "Alexandra Fox", tr, tg, tb); + font::print(PR_2X | PR_CEN | PR_FONT_8X8, -1, 160, "mothbeanie", tr, tg, tb); + break; + case Menu::credits_localisations_translations: + { + font::print_wrap(PR_2X | PR_CEN | PR_FONT_8X8, -1, 15, loc::gettext("Translators"), tr, tg, tb); + + int startidx = game.current_credits_list_index; + int endidx = game.current_credits_list_index; + endidx += Credits::translator_pagesize[game.translator_credits_pagenum]; + endidx = SDL_min(endidx, (int)SDL_arraysize(Credits::translators)); + + int maxheight = 110; + + int totalheight = (endidx - startidx) * 10; + int emptyspace = maxheight - totalheight; + + int yofs = 50 + (emptyspace / 2); + + for (int i = startidx; i < endidx; ++i) + { + if (Credits::translators[i][0] != ' ') + { + yofs += 5; + font::print(PR_FONT_8X8, 80, yofs, loc::gettext(Credits::translators[i]), tr, tg, tb); + }else{ + font::print(PR_FONT_8X8, 80, yofs, Credits::translators[i], tr, tg, tb); + } + yofs += 10; + } + break; + } case Menu::credits3: { font::print_wrap(PR_CEN, -1, 20, loc::gettext("VVVVVV is supported by the following patrons"), tr, tg, tb); @@ -1967,9 +2005,16 @@ void gamecompleterender(void) creditOffset += 40; if (graphics.onscreen(creditOffset + position)) { - font::print(PR_CJK_HIGH | PR_CEN, -1, creditOffset + position, loc::gettext("Translators"), tr, tg, tb); + font::print(PR_CJK_HIGH, 40, creditOffset + position, loc::gettext("With contributions on GitHub from"), tr, tg, tb); + font::print(PR_2X | PR_FONT_8X8, 60, creditOffset + position + 10, "Alexandra Fox", tr, tg, tb); + font::print(PR_2X | PR_FONT_8X8, 60, creditOffset + position + 30, "mothbeanie", tr, tg, tb); } - creditOffset += 20; + creditOffset += 100; + if (graphics.onscreen(creditOffset + position)) + { + font::print(PR_2X | PR_CJK_HIGH | PR_CEN, -1, creditOffset + position, loc::gettext("Translators"), tr, tg, tb); + } + creditOffset += 40; for (size_t i = 0; i < SDL_arraysize(Credits::translators); i += 1) { if (graphics.onscreen(creditOffset + position))