Moar translation support

This commit is contained in:
Julie Marchant 2019-06-10 09:22:43 -04:00
parent f205d7cc44
commit cea10fd3fb
4 changed files with 63 additions and 39 deletions

View File

@ -77,11 +77,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define X_VIEW_BORDER 100
#define Y_VIEW_BORDER 100
#define CAMERA_MAX_SPEED 3.
#define MAX_HOMING 20
#define MAX_DOUBLE_HOMING (game.difficulty != DIFFICULTY_ORIGINAL ? 15 : 10)
#define MAX_MICRO_HOMING 10
#define RAY_INTERVAL 250
#define RAY_DAMAGE_DELAY 5
#define WARP_SPEED MAX(12, 3 * screen->w / 200)
#define ALIEN_WARP_SPEED MIN(-15, -3 * screen->w / 160)
#define ALIEN_WARP_ACCEL (game.difficulty == DIFFICULTY_ORIGINAL ? -15: -0.5)
@ -94,6 +97,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MENU_W 400
#define MENU_SPACING 20
#define SLAVE_RESCUE_TARGET 250
// Object Flags
#define FL_WEAPCO (1L << 0)
#define FL_FRIEND (1L << 1)

View File

@ -1887,16 +1887,16 @@ static void game_doHud()
if (game.area != MISN_INTERCEPTION)
{
screen_blitText(TS_OBJECTIVES_T, screen->w - 250, 20);
sprintf(text, "%d", (mission.remainingObjectives1 + mission.remainingObjectives2));
/// "%d" must be retained. It is replaced with the number of mission objectives remaining.
sprintf(text, _("Objectives Remaining: %d"), (mission.remainingObjectives1 + mission.remainingObjectives2));
gfx_createTextObject(TS_OBJECTIVES, text, 0, 0, FONT_WHITE);
screen_blitText(TS_OBJECTIVES, screen->w - 55, 21);
screen_blitText(TS_OBJECTIVES, screen->w - gfx_textSprites[TS_OBJECTIVES].image->w - 25, 20);
}
screen_blitText(TS_CASH_T, 25, 20);
sprintf(text, "%.6d", game.cash);
/// "%d" must be retained. It is replaced with the player's current total cash.
sprintf(text, _("Cash: $%d"), game.cash);
gfx_createTextObject(TS_CASH, text, 0, 0, FONT_WHITE);
screen_blitText(TS_CASH, 90, 21);
screen_blitText(TS_CASH, 25, 20);
if (game.difficulty == DIFFICULTY_ORIGINAL)
{
@ -1930,23 +1930,28 @@ static void game_doHud()
if (player.ammo[0] <= 25) fontColor = FONT_YELLOW;
if (player.ammo[0] <= 10) fontColor = FONT_RED;
}
screen_blitText(TS_PLASMA_T, screen->w * 5 / 16, screen->h - 50);
sprintf(text, "%.3d", player.ammo[0]);
/// "%.3d" must be retained. It is replaced with the amount of plasma ammo.
sprintf(text, _("Plasma: %.3d"), player.ammo[0]);
gfx_createTextObject(TS_PLASMA, text, 0, 0, fontColor);
screen_blitText(TS_PLASMA, screen->w * 5 / 16 + 70, screen->h - 49);
screen_blitText(TS_PLASMA, screen->w * 5 / 16, screen->h - 50);
screen_blitText(TS_AMMO_T, screen->w / 2, screen->h - 50);
if ((player.weaponType[1] != W_CHARGER) && (player.weaponType[1] != W_LASER))
if (player.weaponType[1] == W_CHARGER)
{
if (player.ammo[1] == 1)
fontColor = FONT_RED;
else
fontColor = FONT_WHITE;
sprintf(text, "%.2d", player.ammo[1]); // rocket ammo
gfx_createTextObject(TS_AMMO, text, 0, 0, fontColor);
screen_blitText(TS_AMMO, screen->w / 2 + 80, screen->h - 49);
/// Used to indicate the charge meter for the charger cannon in the HUD.
gfx_createTextObject(TS_AMMO, _("Charge"), 0, 0, FONT_WHITE);
}
else if (player.weaponType[1] == W_LASER)
{
/// Used to indicate the heat meter for the laser cannon in the HUD.
gfx_createTextObject(TS_AMMO, _("Heat"), 0, 0, FONT_WHITE);
}
else
{
/// "%.2d" must be retained. It is replaced with the amount of rocket ammo.
sprintf(text, _("Rockets: %.2d"), player.ammo[1]);
gfx_createTextObject(TS_AMMO, text, 0, 0, FONT_WHITE);
}
screen_blitText(TS_AMMO, screen->w / 2, screen->h - 50);
if (((player.weaponType[1] == W_CHARGER) || (player.weaponType[1] == W_LASER)) && (player.ammo[1] > 0))
{
@ -1954,7 +1959,7 @@ static void game_doHud()
if (player.ammo[1] > 100)
c = red;
bar.x = screen->w / 2 + 65;
bar.x = screen->w / 2 + gfx_textSprites[TS_AMMO].image->w + 10;
bar.y = screen->h - 50;
bar.h = 12;

View File

@ -919,7 +919,9 @@ static void intermission_createMissionDetailSurface(SDL_Surface *comms, int miss
case MISN_RESCUESLAVES:
/// Mission dialog: Eyananth, interceptions (Sid Wilson)
strcpy(string, _("As you know, WEAPCO has many slaves in this system. If we free a large number of them, it might help to spark a rebellion. I estimate that we will need to rescue around 250 to make a difference."));
/// "%d" must be retained as-is. It is replaced with the number of slaves that
/// need to be rescued.
sprintf(string, _("As you know, WEAPCO has many slaves in this system. If we free a large number of them, it might help to spark a rebellion. I estimate that we will need to rescue around %d to make a difference."), SLAVE_RESCUE_TARGET);
y = intermission_renderDialog(comms, y, FS_SID, string);
/// Mission dialog: Eyananth, interceptions (Chris Bainfield)

View File

@ -736,7 +736,7 @@ static void mission_evaluate(int type, int id, int *completed, int *targetValue,
case MISN_ALLEZ:
/// Dialog (friendly transport from Eyananth, Allez mission)
/// Used when the friendly transport in the Allez mission is destroyed.
radio_setMessage(FS_CREW, _("Noooo! Hull bre-..."), 1);
radio_setMessage(FS_CREW, _("No no no no no! Hull bre-..."), 1);
break;
case MISN_URUSOR:
/// Dialog (Sid Wilson)
@ -801,13 +801,15 @@ static void mission_evaluate(int type, int id, int *completed, int *targetValue,
void mission_updateRequirements(int type, int id, int value)
{
char message[STRMAX_SHORT];
char fmt[STRMAX_SHORT];
int matched = 0;
int slavesNeeded;
// Can't complete missions if you're dead!
if (player.shield <= 0)
return;
char message[25];
char matched = 0;
// We don't need to worry here since if Sid dies,
// you will automatically fail the mission(!)
if ((type == M_DESTROY_TARGET_TYPE) && (id == CD_SID))
@ -864,7 +866,7 @@ void mission_updateRequirements(int type, int id, int value)
{
if (intermission_planets[PLANET_RESCUESLAVES].missionCompleted == 0)
{
if (game.slavesRescued >= 250)
if (game.slavesRescued >= SLAVE_RESCUE_TARGET)
{
info_setLine(_("*** Slaves Rescued - Mission Completed ***"), FONT_GREEN);
intermission_planets[PLANET_RESCUESLAVES].missionCompleted = 1;
@ -874,8 +876,26 @@ void mission_updateRequirements(int type, int id, int value)
}
else
{
// XXX: Plurals
sprintf(message, _("Rescue %d more..."), 250 - game.slavesRescued);
slavesNeeded = SLAVE_RESCUE_TARGET - game.slavesRescued;
radio_getRandomMessage(fmt, ngettext(
/// Info line messages for remaining slaves to rescue (singular)
/// This is a "\n"-separated list of possible choices to make. Please feel free
/// to add as many as you like. Each entry must have one instance of "%d", which
/// is replaced with the number remaining.
"Rescue %d more slave...\n"
"Rescue at least %d more slave...\n"
"At least %d more slave to rescue...\n"
"At least %d more rescued slave needed...",
/// Info line messages for remaining slaves to rescue (plural)
/// This is a "\n"-separated list of possible choices to make. Please feel free
/// to add as many as you like. Each entry must have one instance of "%d", which
/// is replaced with the number remaining.
"Rescue %d more slaves...\n"
"Rescue at least %d more slaves...\n"
"At least %d more slaves to rescue...\n"
"At least %d more rescued slaves needed...",
slavesNeeded));
sprintf(message, fmt, slavesNeeded);
info_setLine(message, FONT_CYAN);
}
}
@ -1149,27 +1169,19 @@ mission begins playing here.
*/
void mission_showStartScreen()
{
// TODO: Replace all "TS_*_T" objs with string formatting, plus adjust
// spacing for things like TS_SHIELD
screen_clear(black);
renderer_update();
gfx_loadSprites();
/// Used to indicate the player's shield meter in the HUD.
gfx_createTextObject(TS_SHIELD, _("Shield"), 0, 0, FONT_WHITE);
gfx_createTextObject(TS_PLASMA_T, _("Plasma:"), 0, 0, FONT_WHITE);
if (player.weaponType[1] == W_CHARGER)
gfx_createTextObject(TS_AMMO_T, _("Charge"), 0, 0, FONT_WHITE);
else if (player.weaponType[1] == W_LASER)
gfx_createTextObject(TS_AMMO_T, _("Heat"), 20, 0, FONT_WHITE);
else
gfx_createTextObject(TS_AMMO_T, _("Rockets:"), 0, 0, FONT_WHITE);
gfx_createTextObject(TS_TARGET, _("Target"), 0, 0, FONT_WHITE);
gfx_createTextObject(TS_TARGET_SID, _("Sid"), 0, 0, FONT_WHITE);
gfx_createTextObject(TS_TARGET_PHOEBE, _("Phoebe"), 0, 0, FONT_WHITE);
gfx_createTextObject(TS_TARGET_KLINE, _("Kline"), 0, 0, FONT_WHITE);
// XXX: Bad assumption! Replace with string formatting ASAP!
gfx_createTextObject(TS_CASH_T, "Cash: $", 0, 0, FONT_WHITE);
gfx_createTextObject(TS_OBJECTIVES_T, "Objectives Remaining:", 0, 0, FONT_WHITE);
gfx_createTextObject(TS_TIME_T, "Time Remaining - ", 0, 0, FONT_WHITE);
gfx_createTextObject(TS_POWER, "Power", 0, 0, FONT_WHITE);
gfx_createTextObject(TS_OUTPUT, "Output", 0, 0, FONT_WHITE);