1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-05 02:39:41 +01:00

Add per-area untranslated roomname counters

This makes it easy from the "explore game" menu to see which levels
still have untranslated room names and how many.
This commit is contained in:
Dav999-v 2022-11-27 20:06:08 +01:00 committed by Misa Elizabeth Kai
parent 46af7ecdfc
commit 88c8ad5a57
8 changed files with 128 additions and 4 deletions

View file

@ -25,4 +25,8 @@
<translation form="0" translation=""/>
<translation form="1" translation=""/>
</string>
<string english_plural="{n} normal room names untranslated" english_singular="{n} normal room name untranslated" explanation="per-area counts for room name translator mode" max="38*4" var="n" expect="48">
<translation form="0" translation=""/>
<translation form="1" translation=""/>
</string>
</strings_plural>

View file

@ -25,4 +25,8 @@
<translation form="0" translation="Plej malfacila ĉambro (kun {n_deaths} mortoj)"/>
<translation form="1" translation="Plej malfacila ĉambro (kun {n_deaths} morto)"/>
</string>
<string english_plural="{n} normal room names untranslated" english_singular="{n} normal room name untranslated" explanation="per-area counts for room name translator mode" max="38*4" var="n" expect="48">
<translation form="0" translation=""/>
<translation form="1" translation=""/>
</string>
</strings_plural>

View file

@ -25,4 +25,8 @@
<translation form="0" translation=""/>
<translation form="1" translation=""/>
</string>
<string english_plural="{n} normal room names untranslated" english_singular="{n} normal room name untranslated" explanation="per-area counts for room name translator mode" max="38*4" var="n" expect="48">
<translation form="0" translation=""/>
<translation form="1" translation=""/>
</string>
</strings_plural>

View file

@ -25,4 +25,8 @@
<translation form="0" translation="Moeilijkste kamer ({n_deaths} keer dood)"/>
<translation form="1" translation="Moeilijkste kamer ({n_deaths} keer dood)"/>
</string>
<string english_plural="{n} normal room names untranslated" english_singular="{n} normal room name untranslated" explanation="per-area counts for room name translator mode" max="38*4" var="n" expect="48">
<translation form="0" translation="{n} normale kamernamen onvertaald"/>
<translation form="1" translation="{n} normale kamernaam onvertaald"/>
</string>
</strings_plural>

View file

@ -26,6 +26,7 @@ int n_untranslated_roomnames = 0;
int n_unexplained_roomnames = 0;
int n_untranslated_roomnames_custom = 0;
int n_unexplained_roomnames_custom = 0;
int n_untranslated_roomnames_area[9];
int n_untranslated[COUNT_UNTRANSLATED_INDEX] = {0};

View file

@ -57,6 +57,7 @@ extern int n_untranslated_roomnames;
extern int n_unexplained_roomnames;
extern int n_untranslated_roomnames_custom;
extern int n_unexplained_roomnames_custom;
extern int n_untranslated_roomnames_area[9];
enum n_untranslated_index
{

View file

@ -241,6 +241,7 @@ void resettext(bool final_shutdown)
n_untranslated_roomnames = 0;
n_unexplained_roomnames = 0;
SDL_zeroa(n_untranslated_roomnames_area);
SDL_zeroa(n_untranslated);
@ -736,16 +737,99 @@ bool fix_room_coords(bool custom_level, int* roomx, int* roomy)
return !(*roomx < 0 || *roomy < 0 || *roomx > max_x || *roomy > max_y);
}
static void update_left_counter(const char* old_text, const char* new_text, int* counter)
static unsigned coords_to_area(int roomx, int roomy)
{
if (!fix_room_coords(false, &roomx, &roomy))
{
return false;
}
/* We want to know per-area how many room names are untranslated... */
enum area_letter {
_, /* None */
S, /* SS1 */
L, /* Lab */
T, /* Tower */
Y, /* SS2 */
W, /* Warp */
I, /* Intermission */
G, /* Gravitron */
F /* Final */
};
static enum area_letter area_map[MAP_MAX_Y+1][MAP_MAX_Y+1] = {
{_,L,L,L,L,L,L,L,_,T,_,_,_,W,W,W,W,W,W,W},
{_,L,L,L,L,L,L,_,_,T,_,_,_,_,W,W,W,W,W,W},
{_,_,_,_,L,_,_,_,_,T,_,_,_,_,W,W,W,W,W,W},
{_,_,_,_,L,_,_,_,_,T,_,_,S,S,S,S,W,W,W,W},
{_,_,L,L,L,_,_,_,_,T,T,T,S,S,S,S,_,_,_,_},
{_,_,_,_,_,_,_,_,_,T,Y,Y,S,S,S,S,_,_,_,_},
{_,_,_,_,_,_,_,_,_,T,Y,Y,S,S,S,S,S,_,_,_},
{_,_,_,_,_,_,_,_,_,T,Y,Y,S,S,S,S,S,S,S,_},
{_,_,_,_,_,_,_,_,_,T,_,_,_,Y,Y,S,Y,Y,Y,_},
{_,_,_,_,_,_,_,_,T,T,_,_,_,Y,Y,Y,Y,Y,Y,_},
{_,_,_,_,_,_,_,_,_,T,_,_,_,Y,Y,Y,Y,Y,Y,_},
{_,_,_,_,_,_,_,_,_,T,_,Y,Y,Y,Y,Y,Y,Y,Y,_},
{_,_,_,_,_,_,_,_,_,T,_,Y,Y,Y,Y,Y,Y,_,Y,_},
{_,_,_,_,_,_,_,_,_,T,_,Y,Y,Y,Y,Y,Y,_,Y,_},
{_,_,_,_,_,_,_,_,_,T,_,Y,Y,_,_,_,_,_,Y,_},
{_,_,_,_,_,_,_,L,_,T,_,_,_,_,_,_,_,_,_,_},
{_,_,L,L,L,L,L,L,_,T,_,_,_,_,_,_,_,_,_,_},
{_,L,L,L,L,L,L,L,_,T,_,_,_,_,_,_,_,_,_,_},
{L,L,L,L,L,_,_,L,_,T,_,_,_,_,_,_,_,_,_,_},
{L,L,L,L,L,_,_,L,_,T,_,_,_,_,_,_,_,_,_,_}
};
static bool area_map_has_final = false;
if (!area_map_has_final)
{
static const enum area_letter final_map[9][14] = {
{_,_,_,_,_,_,_,_,_,_,_,_,G,F},
{_,_,_,_,_,_,_,_,_,_,_,_,G,F},
{_,_,_,_,_,_,_,_,_,_,_,_,G,F},
{F,F,F,F,F,F,F,F,F,F,_,_,G,F},
{F,F,F,F,F,_,F,F,F,F,_,_,G,F},
{_,_,_,_,_,_,_,_,F,F,F,F,F,F},
{_,_,_,_,_,F,F,F,F,F,F,_,_,_},
{_,_,_,_,_,_,_,_,_,_,_,_,_,_},
{I,I,I,I,I,I,I,I,I,I,I,I,I,I}
};
for (int y = 0; y < 9; y++)
{
for (int x = 0; x < 14; x++)
{
area_map[MAP_MAX_Y+1 - 9 + y][MAP_MAX_X+1 - 14 + x] = final_map[y][x];
}
}
area_map_has_final = true;
}
if (area_map[roomy][roomx] == 0)
{
vlog_error("LocalizationStorage: Room %d,%d has no area associated with it", roomx, roomy);
}
return area_map[roomy][roomx];
}
static void update_left_counter(const char* old_text, const char* new_text, int* counter, int* counter_area)
{
bool now_filled = new_text[0] != '\0';
if ((old_text == NULL || old_text[0] == '\0') && now_filled)
{
(*counter)--;
if (counter_area != NULL)
{
(*counter_area)--;
}
}
else if (old_text != NULL && old_text[0] != '\0' && !now_filled)
{
(*counter)++;
if (counter_area != NULL)
{
(*counter_area)++;
}
}
}
@ -760,6 +844,7 @@ bool store_roomname_translation(bool custom_level, int roomx, int roomy, const c
const char** ptr_translation;
const char** ptr_explanation;
int* ptr_n_untranslated;
int* ptr_n_untranslated_area = NULL;
int* ptr_n_unexplained;
if (custom_level)
{
@ -773,17 +858,18 @@ bool store_roomname_translation(bool custom_level, int roomx, int roomy, const c
ptr_translation = &translation_roomnames[roomy][roomx];
ptr_explanation = &explanation_roomnames[roomy][roomx];
ptr_n_untranslated = &n_untranslated_roomnames;
ptr_n_untranslated_area = &n_untranslated_roomnames_area[coords_to_area(roomx, roomy)];
ptr_n_unexplained = &n_unexplained_roomnames;
}
if (tra != NULL)
{
update_left_counter(*ptr_translation, tra, ptr_n_untranslated);
update_left_counter(*ptr_translation, tra, ptr_n_untranslated, ptr_n_untranslated_area);
*ptr_translation = textbook_store(&textbook_main, tra);
}
if (explanation != NULL)
{
update_left_counter(*ptr_explanation, explanation, ptr_n_unexplained);
update_left_counter(*ptr_explanation, explanation, ptr_n_unexplained, NULL);
*ptr_explanation = textbook_store(&textbook_main, explanation);
}
@ -840,6 +926,7 @@ static void loadtext_roomnames(bool custom_level)
{
n_untranslated_roomnames++;
n_unexplained_roomnames++;
n_untranslated_roomnames_area[coords_to_area(x, y)]++;
}
store_roomname_translation(
@ -901,6 +988,7 @@ void loadtext(bool check_max)
// We may still need the room name explanations
loadtext_roomnames(false);
n_untranslated_roomnames = 0;
SDL_zeroa(n_untranslated_roomnames_area);
}
}
else

View file

@ -782,7 +782,25 @@ static void menurender(void)
graphics.bigprint( -1, 30, loc::gettext("The Final Level"), tr, tg, tb, true);
break;
}
if (!roomname_translator::enabled)
if (roomname_translator::enabled)
{
if (game.currentmenuoption >= 0 && game.currentmenuoption < 8)
{
int names_left = loc::n_untranslated_roomnames_area[game.currentmenuoption + 1];
int coldiv = names_left > 0 ? 1 : 2;
char buffer[4*SCREEN_WIDTH_CHARS + 1];
loc::gettext_plural_fill(
buffer, sizeof(buffer),
"{n} normal room names untranslated",
"{n} normal room name untranslated",
"n:int",
names_left
);
graphics.PrintWrap( -1, 65, buffer, tr/coldiv, tg/coldiv, tb/coldiv, true);
}
}
else
{
graphics.PrintWrap( -1, 65, loc::gettext("You have not enabled room name translation mode!"), tr, tg, tb, true);
}