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

Game.cpp: Make Game::updatestate translatable

This mainly adds loc::gettext calls.

This commit is part of rewritten history of the localization branch.
The original (unsquashed) commit history can be found here:
https://github.com/Dav999-v/VVVVVV/tree/localization-orig
This commit is contained in:
Dav999-v 2022-12-30 23:35:26 +01:00 committed by Misa Elizabeth Kai
parent 713fc00034
commit e96a0344e7

View file

@ -800,7 +800,11 @@ void Game::updatestate(void)
break; break;
case 4: case 4:
//End of opening cutscene for now //End of opening cutscene for now
graphics.createtextbox(" Press arrow keys or WASD to move ", -1, 195, 174, 174, 174); graphics.createtextbox(loc::gettext("Press arrow keys or WASD to move"), -1, 195, 174, 174, 174);
graphics.textboxwrap(4);
graphics.textboxcentertext();
graphics.textboxpad(2, 2);
graphics.textboxcenterx();
graphics.textboxtimer(60); graphics.textboxtimer(60);
setstate(0); setstate(0);
break; break;
@ -827,8 +831,11 @@ void Game::updatestate(void)
if (!obj.flags[13]) if (!obj.flags[13])
{ {
obj.flags[13] = true; obj.flags[13] = true;
graphics.createtextbox(" Press ENTER to view map ", -1, 155, 174, 174, 174); graphics.createtextbox(loc::gettext("Press ENTER to view map and quicksave"), -1, 155, 174, 174, 174);
graphics.addline(" and quicksave"); graphics.textboxwrap(4);
graphics.textboxcentertext();
graphics.textboxpad(2, 2);
graphics.textboxcenterx();
graphics.textboxtimer(60); graphics.textboxtimer(60);
} }
setstate(0); setstate(0);
@ -888,52 +895,42 @@ void Game::updatestate(void)
break; break;
case 11: case 11:
{
//Intermission 1 instructional textbox, depends on last saved //Intermission 1 instructional textbox, depends on last saved
graphics.textboxremovefast(); graphics.textboxremovefast();
graphics.createtextbox(" When you're NOT standing on ", -1, 3, 174, 174, 174); const char* floorceiling = graphics.flipmode ? "ceiling" : "floor";
if (graphics.flipmode) const char* crewmate;
switch (lastsaved)
{ {
if (lastsaved == 2) case 2:
{ crewmate = "Vitellary";
graphics.addline(" the ceiling, Vitellary will"); break;
} case 3:
else if (lastsaved == 3) crewmate = "Vermilion";
{ break;
graphics.addline(" the ceiling, Vermilion will"); case 4:
} crewmate = "Verdigris";
else if (lastsaved == 4) break;
{ case 5:
graphics.addline(" the ceiling, Verdigris will"); crewmate = "Victoria";
} break;
else if (lastsaved == 5) default:
{ crewmate = "your companion";
graphics.addline(" the ceiling, Victoria will");
}
} }
else char english[SCREEN_WIDTH_TILES*3 + 1]; /* ASCII only */
{ vformat_buf(english, sizeof(english),
if (lastsaved == 2) "When you're NOT standing on the {floorceiling}, {crewmate} will stop and wait for you.",
{ "floorceiling:str, crewmate:str",
graphics.addline(" the floor, Vitellary will"); floorceiling, crewmate
} );
else if (lastsaved == 3) graphics.createtextbox(loc::gettext(english), -1, 3, 174, 174, 174);
{ graphics.textboxwrap(2);
graphics.addline(" the floor, Vermilion will"); graphics.textboxpadtowidth(36*8);
} graphics.textboxcenterx();
else if (lastsaved == 4)
{
graphics.addline(" the floor, Verdigris will");
}
else if (lastsaved == 5)
{
graphics.addline(" the floor, Victoria will");
}
}
graphics.addline(" stop and wait for you.");
graphics.textboxtimer(180); graphics.textboxtimer(180);
setstate(0); setstate(0);
break; break;
}
case 12: case 12:
//Intermission 1 instructional textbox, depends on last saved //Intermission 1 instructional textbox, depends on last saved
obj.removetrigger(12); obj.removetrigger(12);
@ -941,15 +938,24 @@ void Game::updatestate(void)
{ {
obj.flags[61] = true; obj.flags[61] = true;
graphics.textboxremovefast(); graphics.textboxremovefast();
graphics.createtextbox(" You can't continue to the next ", -1, 8, 174, 174, 174); const char* english;
if (lastsaved == 5) switch (lastsaved)
{ {
graphics.addline(" room until she is safely across. "); case 2:
} case 3:
else case 4:
{ english = "You can't continue to the next room until he is safely across.";
graphics.addline(" room until he is safely across. "); break;
case 5:
english = "You can't continue to the next room until she is safely across.";
break;
default:
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.textboxwrap(2);
graphics.textboxpadtowidth(36*8);
graphics.textboxcenterx();
graphics.textboxtimer(120); graphics.textboxtimer(120);
} }
setstate(0); setstate(0);
@ -961,36 +967,42 @@ void Game::updatestate(void)
setstate(0); setstate(0);
break; break;
case 14: case 14:
{
//Intermission 1 instructional textbox, depends on last saved //Intermission 1 instructional textbox, depends on last saved
if (graphics.flipmode) const char* floorceiling = graphics.flipmode ? "ceiling" : "floor";
const char* crewmate;
switch (lastsaved)
{ {
graphics.createtextbox(" When you're standing on the ceiling, ", -1, 3, 174, 174, 174); case 2:
} crewmate = "Vitellary";
else break;
{ case 3:
graphics.createtextbox(" When you're standing on the floor, ", -1, 3, 174, 174, 174); crewmate = "Vermilion";
} break;
if (lastsaved == 2) case 4:
{ crewmate = "Verdigris";
graphics.addline(" Vitellary will try to walk to you. "); break;
} case 5:
else if (lastsaved == 3) crewmate = "Victoria";
{ break;
graphics.addline(" Vermilion will try to walk to you. "); default:
} crewmate = "your companion";
else if (lastsaved == 4)
{
graphics.addline(" Verdigris will try to walk to you. ");
}
else if (lastsaved == 5)
{
graphics.addline(" Victoria will try to walk to you. ");
} }
char english[SCREEN_WIDTH_TILES*3 + 1]; /* ASCII only */
vformat_buf(english, sizeof(english),
"When you're standing on the {floorceiling}, {crewmate} will try to walk to you.",
"floorceiling:str, crewmate:str",
floorceiling, crewmate
);
graphics.createtextbox(loc::gettext(english), -1, 3, 174, 174, 174);
graphics.textboxwrap(2);
graphics.textboxpadtowidth(36*8);
graphics.textboxcenterx();
graphics.textboxtimer(280); graphics.textboxtimer(280);
setstate(0); setstate(0);
break; break;
}
case 15: case 15:
{ {
//leaving the naughty corner //leaving the naughty corner
@ -1018,8 +1030,11 @@ void Game::updatestate(void)
case 17: case 17:
//Arrow key tutorial //Arrow key tutorial
obj.removetrigger(17); obj.removetrigger(17);
graphics.createtextbox(" If you prefer, you can press UP or ", -1, 195, 174, 174, 174); graphics.createtextbox(loc::gettext("If you prefer, you can press UP or DOWN instead of ACTION to flip."), -1, 187, 174, 174, 174);
graphics.addline(" DOWN instead of ACTION to flip."); graphics.textboxwrap(2);
graphics.textboxcentertext();
graphics.textboxpad(1, 1);
graphics.textboxcenterx();
graphics.textboxtimer(100); graphics.textboxtimer(100);
setstate(0); setstate(0);
break; break;
@ -1048,7 +1063,11 @@ void Game::updatestate(void)
graphics.textboxremovefast(); graphics.textboxremovefast();
obj.flags[3] = true; obj.flags[3] = true;
setstate(0); setstate(0);
graphics.createtextbox(" Press ACTION to flip ", -1, 25, 174, 174, 174); graphics.createtextbox(loc::gettext("Press ACTION to flip"), -1, 25, 174, 174, 174);
graphics.textboxwrap(4);
graphics.textboxcentertext();
graphics.textboxpad(2, 2);
graphics.textboxcenterx();
graphics.textboxtimer(60); graphics.textboxtimer(60);
} }
obj.removetrigger(22); obj.removetrigger(22);
@ -1389,53 +1408,56 @@ void Game::updatestate(void)
case 50: case 50:
music.playef(15); music.playef(15);
graphics.createtextbox("Help! Can anyone hear", 35, 15, 255, 134, 255); graphics.createtextbox(loc::gettext("Help! Can anyone hear this message?"), 5, 8, 255, 134, 255);
graphics.addline("this message?"); graphics.textboxcommsrelay();
graphics.textboxtimer(60); graphics.textboxtimer(60);
incstate(); incstate();
setstatedelay(100); setstatedelay(100);
break; break;
case 51: case 51:
music.playef(15); music.playef(15);
graphics.createtextbox("Verdigris? Are you out", 30, 12, 255, 134, 255); graphics.createtextbox(loc::gettext("Verdigris? Are you out there? Are you ok?"), 5, 8, 255, 134, 255);
graphics.addline("there? Are you ok?"); graphics.textboxcommsrelay();
graphics.textboxtimer(60); graphics.textboxtimer(60);
incstate(); incstate();
setstatedelay(100); setstatedelay(100);
break; break;
case 52: case 52:
music.playef(15); music.playef(15);
graphics.createtextbox("Please help us! We've crashed", 5, 22, 255, 134, 255); graphics.createtextbox(loc::gettext("Please help us! We've crashed and need assistance!"), 5, 8, 255, 134, 255);
graphics.addline("and need assistance!"); graphics.textboxcommsrelay();
graphics.textboxtimer(60); graphics.textboxtimer(60);
incstate(); incstate();
setstatedelay(100); setstatedelay(100);
break; break;
case 53: case 53:
music.playef(15); music.playef(15);
graphics.createtextbox("Hello? Anyone out there?", 40, 15, 255, 134, 255); graphics.createtextbox(loc::gettext("Hello? Anyone out there?"), 5, 8, 255, 134, 255);
graphics.textboxcommsrelay();
graphics.textboxtimer(60); graphics.textboxtimer(60);
incstate(); incstate();
setstatedelay(100); setstatedelay(100);
break; break;
case 54: case 54:
music.playef(15); music.playef(15);
graphics.createtextbox("This is Doctor Violet from the", 5, 8, 255, 134, 255); graphics.createtextbox(loc::gettext("This is Doctor Violet from the D.S.S. Souleye! Please respond!"), 5, 8, 255, 134, 255);
graphics.addline("D.S.S. Souleye! Please respond!"); graphics.textboxcommsrelay();
graphics.textboxtimer(60); graphics.textboxtimer(60);
incstate(); incstate();
setstatedelay(100); setstatedelay(100);
break; break;
case 55: case 55:
music.playef(15); music.playef(15);
graphics.createtextbox("Please... Anyone...", 45, 14, 255, 134, 255); graphics.createtextbox(loc::gettext("Please... Anyone..."), 5, 8, 255, 134, 255);
graphics.textboxcommsrelay();
graphics.textboxtimer(60); graphics.textboxtimer(60);
incstate(); incstate();
setstatedelay(100); setstatedelay(100);
break; break;
case 56: case 56:
music.playef(15); music.playef(15);
graphics.createtextbox("Please be alright, everyone...", 25, 18, 255, 134, 255); graphics.createtextbox(loc::gettext("Please be alright, everyone..."), 5, 8, 255, 134, 255);
graphics.textboxcommsrelay();
graphics.textboxtimer(60); graphics.textboxtimer(60);
setstate(50); setstate(50);
setstatedelay(100); setstatedelay(100);
@ -1893,27 +1915,43 @@ void Game::updatestate(void)
setstatedelay(15); setstatedelay(15);
break; break;
case 1001: case 1001:
{
//Found a trinket! //Found a trinket!
advancetext = true; advancetext = true;
incstate(); incstate();
graphics.createtextboxflipme(" Congratulations! ", 50, 85, 174, 174, 174); graphics.createtextboxflipme(loc::gettext("Congratulations!\n\nYou have found a shiny trinket!"), 50, 85, 174, 174, 174);
graphics.addline(""); int h = graphics.textboxwrap(2);
graphics.addline("You have found a shiny trinket!"); graphics.textboxcentertext();
graphics.textboxpad(1, 1);
graphics.textboxcenterx(); graphics.textboxcenterx();
int max_trinkets;
#if !defined(NO_CUSTOM_LEVELS) #if !defined(NO_CUSTOM_LEVELS)
if(map.custommode) if(map.custommode)
{ {
graphics.createtextboxflipme(" " + help.number_words(trinkets()) + " out of " + help.number_words(cl.numtrinkets())+ " ", 50, 135, 174, 174, 174); max_trinkets = cl.numtrinkets();
graphics.textboxcenterx();
} }
else else
#endif #endif
{ {
graphics.createtextboxflipme(" " + help.number_words(trinkets()) + " out of Twenty ", 50, 135, 174, 174, 174); max_trinkets = 20;
graphics.textboxcenterx();
} }
char buffer[SCREEN_WIDTH_CHARS + 1];
vformat_buf(
buffer, sizeof(buffer),
loc::gettext("{n_trinkets|wordy} out of {max_trinkets|wordy}"),
"n_trinkets:int, max_trinkets:int",
trinkets(), max_trinkets
);
graphics.createtextboxflipme(buffer, 50, 95+h, 174, 174, 174);
graphics.textboxwrap(2);
graphics.textboxcentertext();
graphics.textboxpad(1, 1);
graphics.textboxcenterx();
break; break;
}
case 1002: case 1002:
if (!advancetext) if (!advancetext)
{ {
@ -1943,28 +1981,37 @@ void Game::updatestate(void)
break; break;
#if !defined(NO_CUSTOM_LEVELS) #if !defined(NO_CUSTOM_LEVELS)
case 1011: case 1011:
{
//Found a crewmate! //Found a crewmate!
advancetext = true; advancetext = true;
incstate(); incstate();
graphics.createtextboxflipme(" Congratulations! ", 50, 85, 174, 174, 174); graphics.createtextboxflipme(loc::gettext("Congratulations!\n\nYou have found a lost crewmate!"), 50, 85, 174, 174, 174);
graphics.addline(""); int h = graphics.textboxwrap(2);
graphics.addline("You have found a lost crewmate!"); graphics.textboxcentertext();
graphics.textboxpad(1, 1);
graphics.textboxcenterx(); graphics.textboxcenterx();
if(cl.numcrewmates()-crewmates()==0) if(cl.numcrewmates()-crewmates()==0)
{ {
graphics.createtextboxflipme(" All crewmates rescued! ", 50, 135, 174, 174, 174); graphics.createtextboxflipme(loc::gettext("All crewmates rescued!"), 50, 95+h, 174, 174, 174);
}
else if(cl.numcrewmates()-crewmates()==1)
{
graphics.createtextboxflipme(" " + help.number_words(cl.numcrewmates()-crewmates())+ " remains ", 50, 135, 174, 174, 174);
} }
else else
{ {
graphics.createtextboxflipme(" " + help.number_words(cl.numcrewmates()-crewmates())+ " remain ", 50, 135, 174, 174, 174); char buffer[SCREEN_WIDTH_CHARS + 1];
loc::gettext_plural_fill(
buffer, sizeof(buffer),
"{n_crew|wordy} remain", "{n_crew|wordy} remains",
"n_crew:int",
cl.numcrewmates()-crewmates()
);
graphics.createtextboxflipme(buffer, 50, 95+h, 174, 174, 174);
} }
graphics.textboxwrap(4);
graphics.textboxcentertext();
graphics.textboxpad(2, 2);
graphics.textboxcenterx(); graphics.textboxcenterx();
break; break;
}
case 1012: case 1012:
if (!advancetext) if (!advancetext)
{ {
@ -2676,7 +2723,7 @@ void Game::updatestate(void)
music.play(7); music.play(7);
graphics.createtextboxflipme("", -1, 12, 164, 165, 255); graphics.createtextboxflipme("", -1, 12, 164, 165, 255);
graphics.addline(" "); graphics.addline(" ");
graphics.addline(""); graphics.addline("");
graphics.addline(""); graphics.addline("");
graphics.textboxcenterx(); graphics.textboxcenterx();
@ -2686,7 +2733,7 @@ void Game::updatestate(void)
incstate(); incstate();
setstatedelay(45+15); setstatedelay(45+15);
graphics.createtextboxflipme(" All Crew Members Rescued! ", -1, 64, 0, 0, 0); graphics.createtextboxflipme(loc::gettext("All Crew Members Rescued!"), -1, 64, 0, 0, 0);
char buffer[SCREEN_WIDTH_CHARS + 1]; char buffer[SCREEN_WIDTH_CHARS + 1];
timestringcenti(buffer, sizeof(buffer)); timestringcenti(buffer, sizeof(buffer));
savetime = buffer; savetime = buffer;
@ -2697,9 +2744,15 @@ void Game::updatestate(void)
incstate(); incstate();
setstatedelay(45); setstatedelay(45);
std::string tempstring = help.number_words(trinkets()); const char* label = loc::gettext("Trinkets Found:");
graphics.createtextboxflipme("Trinkets Found:", 48, 84, 0,0,0); char buffer[SCREEN_WIDTH_CHARS + 1];
graphics.createtextboxflipme(tempstring, 180, 84, 0, 0, 0); vformat_buf(buffer, sizeof(buffer),
loc::gettext("{gamecomplete_n_trinkets|wordy}"),
"gamecomplete_n_trinkets:int",
trinkets()
);
graphics.createtextboxflipme(label, 168-graphics.len(label), 84, 0,0,0);
graphics.createtextboxflipme(buffer, 180, 84, 0, 0, 0);
break; break;
} }
case 3504: case 3504:
@ -2707,32 +2760,46 @@ void Game::updatestate(void)
incstate(); incstate();
setstatedelay(45+15); setstatedelay(45+15);
const char* label = loc::gettext("Game Time:");
std::string tempstring = savetime; std::string tempstring = savetime;
graphics.createtextboxflipme(" Game Time:", 64, 96, 0,0,0); graphics.createtextboxflipme(label, 168-graphics.len(label), 96, 0,0,0);
graphics.createtextboxflipme(tempstring, 180, 96, 0, 0, 0); graphics.createtextboxflipme(tempstring, 180, 96, 0, 0, 0);
break; break;
} }
case 3505: case 3505:
{
incstate(); incstate();
setstatedelay(45); setstatedelay(45);
graphics.createtextboxflipme(" Total Flips:", 64, 123, 0,0,0); const char* label = loc::gettext("Total Flips:");
graphics.createtextboxflipme(label, 168-graphics.len(label), 123, 0,0,0);
graphics.createtextboxflipme(help.String(totalflips), 180, 123, 0, 0, 0); graphics.createtextboxflipme(help.String(totalflips), 180, 123, 0, 0, 0);
break; break;
}
case 3506: case 3506:
{
incstate(); incstate();
setstatedelay(45+15); setstatedelay(45+15);
graphics.createtextboxflipme("Total Deaths:", 64, 135, 0,0,0); const char* label = loc::gettext("Total Deaths:");
graphics.createtextboxflipme(label, 168-graphics.len(label), 135, 0,0,0);
graphics.createtextboxflipme(help.String(deathcounts), 180, 135, 0, 0, 0); graphics.createtextboxflipme(help.String(deathcounts), 180, 135, 0, 0, 0);
break; break;
}
case 3507: case 3507:
{ {
incstate(); incstate();
setstatedelay(45+15); setstatedelay(45+15);
std::string tempstring = "Hardest Room (with " + help.String(hardestroomdeaths) + " deaths)"; char buffer[SCREEN_WIDTH_CHARS + 1];
graphics.createtextboxflipme(tempstring, -1, 158, 0,0,0); loc::gettext_plural_fill(
buffer, sizeof(buffer),
"Hardest Room (with {n_deaths} deaths)",
"Hardest Room (with {n_deaths} death)",
"n_deaths:int",
hardestroomdeaths
);
graphics.createtextboxflipme(buffer, -1, 158, 0,0,0);
graphics.createtextboxflipme(hardestroom, -1, 170, 0, 0, 0); graphics.createtextboxflipme(hardestroom, -1, 170, 0, 0, 0);
break; break;
} }