i18n updates.

This commit is contained in:
Steve 2018-04-01 17:41:45 +01:00
parent b395c7e8d2
commit 73ace650e1
55 changed files with 292 additions and 77 deletions

View File

@ -49,7 +49,7 @@ _OBJS += objectives.o options.o
_OBJS += particles.o player.o plasmaBlob.o plasmaDroid.o pistolBlob.o pistolDroid.o postMission.o powerPoint.o powerPool.o pressurePlate.o pushBlock.o
_OBJS += quadtree.o
_OBJS += radar.o
_OBJS += savepng.o shotgunBlob.o shotgunDroid.o sound.o spreadGunBlob.o spreadGunDroid.o sprites.o stats.o structures.o
_OBJS += savepng.o shotgunBlob.o shotgunDroid.o sound.o spreadGunBlob.o spreadGunDroid.o sprites.o stats.o strings.o structures.o
_OBJS += tankCommander.o tankTrack.o teeka.o teleporter.o text.o textures.o title.o transition.o triggers.o trophies.o
_OBJS += unit.o util.o
_OBJS += weapons.o weaponPickup.o widgets.o world.o worldLoader.o worldSaver.o worldTest.o

View File

@ -368,3 +368,62 @@ enum
STAT_TIME_PLAYED,
STAT_MAX
};
enum
{
ST_MISSION_COMPLETE,
ST_OBJECTIVES,
ST_INCOMPLETE,
ST_COMPLETE,
ST_PRESS_FIRE,
ST_OPTIONS,
ST_TROPHIES,
ST_PAGE,
ST_HIDDEN,
ST_WEAPON,
ST_CELL,
ST_HEART,
ST_TELEPORTER,
ST_LASERS,
ST_POWER_POINT,
ST_LIFT,
ST_EXIT,
ST_LOCKED,
ST_OPENED,
ST_GOT_GRENADES,
ST_PICKED_UP,
ST_REMOVED,
ST_REQUIRED,
ST_CANNOT_CARRY,
ST_RESCUED,
ST_JETPACK_POWER,
ST_AQUALUNG_POWER,
ST_QUIT_HUB,
ST_QUIT_TUTORIAL,
ST_QUIT_SAVE,
ST_QUIT_LOSE,
ST_MIAS,
ST_ITEMS,
ST_TARGETS,
ST_OBJECTIVE_COMPLETE,
ST_CHERRY_BUNCH,
ST_CHERRY_PAIR,
ST_CHERRY_SMALL,
ST_BATTERY_FULL,
ST_BATTERY,
ST_USED_BATTERY,
ST_WEAK_BATTERY,
ST_CHOOSE_SAVE,
ST_LOAD,
ST_OVERWRITE_1,
ST_OVERWRITE_2,
ST_FREEPLAY,
ST_HEART_CELL,
ST_HUB_MISSIONS,
ST_HUB_MIAS,
ST_HUB_TARGETS,
ST_HUB_KEYS,
ST_HUB_HEARTS,
ST_HUB_CELLS,
ST_MAX
};

View File

@ -290,11 +290,11 @@ static void activate(int activate)
{
if (world.bob->environment == ENV_AIR)
{
setGameplayMessage(MSG_STANDARD, _("Not enough power for jetpack"));
setGameplayMessage(MSG_STANDARD, app.strings[ST_JETPACK_POWER]);
}
else
{
setGameplayMessage(MSG_STANDARD, _("Not enough power for aqualung"));
setGameplayMessage(MSG_STANDARD, app.strings[ST_AQUALUNG_POWER]);
}
}
}

View File

@ -112,7 +112,7 @@ static void touch(Entity *other)
{
m->action = preTeleport;
m->teleportTimer = FPS * 3;
setGameplayMessage(MSG_OBJECTIVE, _("Rescued %s"), m->name);
setGameplayMessage(MSG_OBJECTIVE, app.strings[ST_RESCUED], m->name);
m->isMissionTarget = 0;
m->flags |= EF_ALWAYS_PROCESS;
m->plane = PLANE_FOREGROUND;

View File

@ -29,6 +29,7 @@ extern void playSound(int snd, int ch);
extern void setGameplayMessage(int type, char *format, ...);
extern void updateObjective(char *targetName);
extern App app;
extern Entity *self;
extern Game game;
extern World world;

View File

@ -46,7 +46,7 @@ static void touch(Entity *other)
{
world.bob->power = MIN(world.bob->power + i->power, world.bob->powerMax);
setGameplayMessage(MSG_STANDARD, _("Picked up a %s"), i->name);
setGameplayMessage(MSG_STANDARD, app.strings[ST_PICKED_UP], i->name);
pickupItem();

View File

@ -26,6 +26,7 @@ extern void playSound(int snd, int ch);
extern void setGameplayMessage(int type, char *format, ...);
extern int touchedPlayer(Entity *e);
extern App app;
extern Entity *self;
extern Game game;
extern World world;

View File

@ -64,7 +64,7 @@ static void touch(Entity *other)
world.bob->power = world.bob->powerMax = game.cells;
setGameplayMessage(MSG_OBJECTIVE, _("Found a battery cell - Max power increased!"));
setGameplayMessage(MSG_OBJECTIVE, app.strings[ST_CELL]);
playSound(SND_HEART_CELL, self->uniqueId % MAX_SND_CHANNELS);

View File

@ -26,6 +26,7 @@ extern void playSound(int snd, int ch);
extern void setGameplayMessage(int type, char *format, ...);
extern void updateHeartCellObjective(void);
extern App app;
extern Entity *self;
extern Game game;
extern World world;

View File

@ -43,7 +43,7 @@ static void touch(Entity *other)
{
world.bob->health = limit(world.bob->health + i->value, 0, world.bob->healthMax);
setGameplayMessage(MSG_STANDARD, _("Picked up a %s"), i->name);
setGameplayMessage(MSG_STANDARD, app.strings[ST_PICKED_UP], i->name);
pickupItem();

View File

@ -27,6 +27,7 @@ extern void playSound(int snd, int ch);
extern void setGameplayMessage(int type, char *format, ...);
extern int touchedPlayer(Entity *other);
extern App app;
extern Entity *self;
extern Game game;
extern World world;

View File

@ -76,7 +76,7 @@ static void touch(Entity *other)
world.bob->health = world.bob->healthMax = game.hearts;
setGameplayMessage(MSG_OBJECTIVE, _("Found a heart - Max health increased!"));
setGameplayMessage(MSG_OBJECTIVE, app.strings[ST_HEART]);
playSound(SND_HEART_CELL, self->uniqueId % MAX_SND_CHANNELS);

View File

@ -27,6 +27,7 @@ extern int rrnd(int low, int high);
extern void setGameplayMessage(int type, char *format, ...);
extern void updateHeartCellObjective(void);
extern App app;
extern Entity *self;
extern Game game;
extern World world;

View File

@ -139,13 +139,13 @@ static void bobPickupItem(void)
game.stats[STAT_KEYS_FOUND]++;
updateObjective("KEY");
setGameplayMessage(MSG_STANDARD, _("Picked up a %s"), i->name);
setGameplayMessage(MSG_STANDARD, app.strings[ST_PICKED_UP], i->name);
playSound(SND_KEY, i->uniqueId % MAX_SND_CHANNELS);
}
else
{
setGameplayMessage(MSG_GAMEPLAY, _("Can't carry any more keys"));
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_CANNOT_CARRY]);
}
}
}
@ -159,13 +159,13 @@ static void bobPickupItem(void)
i->collected = 1;
}
setGameplayMessage(MSG_STANDARD, _("Picked up a %s"), i->name);
setGameplayMessage(MSG_STANDARD, app.strings[ST_PICKED_UP], i->name);
playSound(SND_ITEM, i->uniqueId % MAX_SND_CHANNELS);
}
else
{
setGameplayMessage(MSG_GAMEPLAY, _("Can't carry any more items"));
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_CANNOT_CARRY]);
}
}
else
@ -175,7 +175,7 @@ static void bobPickupItem(void)
if (strcmp(world.id, "teeka") != 0)
{
setGameplayMessage(MSG_STANDARD, _("Picked up a %s"), i->name);
setGameplayMessage(MSG_STANDARD, app.strings[ST_PICKED_UP], i->name);
}
playSound(SND_ITEM, i->uniqueId % MAX_SND_CHANNELS);

View File

@ -30,6 +30,7 @@ extern void playSound(int snd, int ch);
extern void setGameplayMessage(int type, char *format, ...);
extern void updateObjective(char *targetName);
extern App app;
extern Entity *self;
extern Game game;
extern World world;

View File

@ -89,11 +89,11 @@ static void touch(Entity *other)
switch (i->weaponType)
{
case WPN_GRENADES:
setGameplayMessage(MSG_STANDARD, _("Got some Grenades"));
setGameplayMessage(MSG_STANDARD, app.strings[ST_GOT_GRENADES]);
break;
default:
setGameplayMessage(MSG_STANDARD, _("Picked up a %s"), getWeaponName(i->weaponType));
setGameplayMessage(MSG_STANDARD, app.strings[ST_PICKED_UP], getWeaponName(i->weaponType));
break;
}

View File

@ -30,6 +30,7 @@ extern void playSound(int snd, int ch);
extern void setGameplayMessage(int type, char *format, ...);
extern int touchedPlayer(Entity *e);
extern App app;
extern Entity *self;
extern Game game;
extern World world;

View File

@ -87,7 +87,7 @@ static void load(cJSON *root)
s = (Structure*)self;
STRNCPY(s->message, cJSON_GetObjectItem(root, "message")->valuestring, MAX_DESCRIPTION_LENGTH);
STRNCPY(s->message, _(cJSON_GetObjectItem(root, "message")->valuestring), MAX_DESCRIPTION_LENGTH);
}
static void save(cJSON *root)

View File

@ -91,7 +91,7 @@ static void touch(Entity *other)
{
activateEntities(s->targetNames, 1);
setGameplayMessage(MSG_GAMEPLAY, _("%s removed"), s->requiredItem);
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_REMOVED], s->requiredItem);
removeItem(s->requiredItem);
@ -104,7 +104,7 @@ static void touch(Entity *other)
}
else if (s->bobTouching == 0)
{
setGameplayMessage(MSG_GAMEPLAY, _("%s required"), s->requiredItem);
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_REQUIRED], s->requiredItem);
playSound(SND_DENIED, s->uniqueId % MAX_SND_CHANNELS);
}

View File

@ -29,5 +29,6 @@ extern void playSound(int snd, int ch);
extern void removeItem(char *name);
extern void setGameplayMessage(int type, char *format, ...);
extern App app;
extern Dev dev;
extern Entity *self;

View File

@ -191,7 +191,7 @@ static void touch(Entity *other)
}
else if (s->thinkTime == 0)
{
setGameplayMessage(MSG_GAMEPLAY, _("Door is locked"));
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_LOCKED]);
playSound(SND_DENIED, s->uniqueId % MAX_SND_CHANNELS);
}
@ -224,7 +224,7 @@ static void openWithKey(void)
{
removeItem(s->requiredItem);
setGameplayMessage(MSG_GAMEPLAY, _("%s removed"), s->requiredItem);
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_REMOVED], s->requiredItem);
STRNCPY(s->requiredItem, "", MAX_NAME_LENGTH);
s->isLocked = 0;
@ -241,7 +241,7 @@ static void openWithKey(void)
if (s->thinkTime <= 0)
{
setGameplayMessage(MSG_GAMEPLAY, _("%s required"), s->requiredItem);
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_REQUIRED], s->requiredItem);
playSound(SND_DENIED, s->uniqueId % MAX_SND_CHANNELS);
}
@ -284,7 +284,7 @@ static void activate(int active)
if (!isOnScreen(self))
{
setGameplayMessage(MSG_GAMEPLAY, "Door opened ...");
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_OPENED]);
}
}
}

View File

@ -34,5 +34,6 @@ extern void playSound(int snd, int ch);
extern void removeItem(char *name);
extern void setGameplayMessage(int type, char *format, ...);
extern App app;
extern Dev dev;
extern Entity *self;

View File

@ -131,7 +131,7 @@ static void touch(Entity *other)
}
else
{
setGameplayMessage(MSG_GAMEPLAY, _("Can't exit yet - required objectives not met"));
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_EXIT]);
}
}

View File

@ -27,5 +27,6 @@ extern void setGameplayMessage(int type, char *format, ...);
extern void stopMusic(void);
extern void updateObjective(char *targetName);
extern App app;
extern Entity *self;
extern World world;

View File

@ -96,7 +96,7 @@ static void touch(Entity *other)
s->active = 1;
setGameplayMessage(MSG_GAMEPLAY, _("%s removed"), s->requiredItem);
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_REMOVED], s->requiredItem);
s->sprite[FACING_LEFT] = s->sprite[FACING_RIGHT] = s->sprite[FACING_DIE] = getSprite("ItemPadActive");
@ -108,7 +108,7 @@ static void touch(Entity *other)
}
else if (!s->bobTouching)
{
setGameplayMessage(MSG_GAMEPLAY, _("%s required"), s->requiredItem);
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_REQUIRED], s->requiredItem);
}
s->bobTouching = 2;

View File

@ -29,4 +29,5 @@ extern void removeItem(char *name);
extern void setGameplayMessage(int type, char *format, ...);
extern void updateObjective(char *targetName);
extern App app;
extern Entity *self;

View File

@ -125,7 +125,7 @@ static void activate(int active)
if (!isOnScreen(self))
{
setGameplayMessage(MSG_GAMEPLAY, _("Platform activated ..."));
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_LIFT]);
}
}
}

View File

@ -30,4 +30,5 @@ extern long lookup(const char *name);
extern void observeActivation(Entity *e);
extern void setGameplayMessage(int type, char *format, ...);
extern App app;
extern Entity *self;

View File

@ -128,7 +128,7 @@ static void touch(Entity *other)
{
if (world.bob->power < s->requiredPower && s->bobTouching == 0 && !dev.cheatPower)
{
setGameplayMessage(MSG_GAMEPLAY, _("Not enough power (%d units required)"), s->requiredPower);
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_POWER_POINT], s->requiredPower);
}
else
{

View File

@ -27,6 +27,7 @@ extern Sprite *getSprite(char *name);
extern int rrnd(int low, int high);
extern void setGameplayMessage(int type, char *format, ...);
extern App app;
extern Dev dev;
extern Entity *self;
extern Game game;

View File

@ -118,7 +118,7 @@ static void activate(int active)
if (!isOnScreen(self))
{
setGameplayMessage(MSG_GAMEPLAY, _("Teleporter activated ..."));
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_TELEPORTER]);
}
}
}

View File

@ -30,4 +30,5 @@ extern void playBattleSound(int snd, int ch, int x, int y);
extern void setGameplayMessage(int type, char *format, ...);
extern void teleportEntity(Entity *e, float tx, float ty);
extern App app;
extern Entity *self;

View File

@ -178,7 +178,7 @@ static void activate(int active)
if (!isOnScreen(self))
{
setGameplayMessage(MSG_GAMEPLAY, _("Lasers disabled ..."));
setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_LASERS]);
}
}
}

View File

@ -33,5 +33,6 @@ extern void setGameplayMessage(int type, char *format, ...);
extern void stunBob(void);
extern void swapSelf(Entity *e);
extern App app;
extern Entity *self;
extern World world;

View File

@ -117,7 +117,7 @@ static void loadEndingText(void)
while (line)
{
strncpy(endingText[i++], line, MAX_DESCRIPTION_LENGTH);
strncpy(endingText[i++], _(line), MAX_DESCRIPTION_LENGTH);
line = strtok(NULL, "\n");
}

View File

@ -166,7 +166,7 @@ static void draw(void)
h = (SCREEN_WIDTH / 800.0) * background->rect.h;
drawText(SCREEN_WIDTH / 2, 50, 40, TA_CENTER, colors.white, "Options");
drawText(SCREEN_WIDTH / 2, 50, 40, TA_CENTER, colors.white, app.strings[ST_OPTIONS]);
blitRectScaled(atlasTexture->texture, 0, SCREEN_HEIGHT - h, SCREEN_WIDTH, h, &background->rect, 0);

View File

@ -145,16 +145,16 @@ static void draw(void)
if (saveAction == SA_NEW)
{
drawText(SCREEN_WIDTH / 2, 275, 24, TA_CENTER, colors.white, "Choose a save slot to use ...");
drawText(SCREEN_WIDTH / 2, 275, 24, TA_CENTER, colors.white, app.strings[ST_CHOOSE_SAVE]);
}
else if (saveAction == SA_LOAD)
{
drawText(SCREEN_WIDTH / 2, 275, 24, TA_CENTER, colors.white, "Choose a save game to load ...");
drawText(SCREEN_WIDTH / 2, 275, 24, TA_CENTER, colors.white, app.strings[ST_LOAD]);
}
else if (saveAction == SA_DELETE)
{
drawText(SCREEN_WIDTH / 2, 350, 24, TA_CENTER, colors.white, "Are you sure you want to overwrite this game?");
drawText(SCREEN_WIDTH / 2, 400, 22, TA_CENTER, colors.white, "All progress will be lost!");
drawText(SCREEN_WIDTH / 2, 350, 24, TA_CENTER, colors.white, app.strings[ST_OVERWRITE_1]);
drawText(SCREEN_WIDTH / 2, 400, 22, TA_CENTER, colors.white, app.strings[ST_OVERWRITE_2]);
}
}

View File

@ -108,9 +108,9 @@ void drawTrophies(void)
drawOutlineRect(r.x, r.y, r.w, r.h, 200, 200, 200, 255);
drawText(SCREEN_WIDTH / 2, 60, 28, TA_CENTER, colors.white, "Trophies");
drawText(SCREEN_WIDTH / 2, 60, 28, TA_CENTER, colors.white, app.strings[ST_TROPHIES]);
drawText(SCREEN_WIDTH / 2, 100, 16, TA_CENTER, colors.lightGrey, "Page %d / %d", page + 1, (int)maxPages);
drawText(SCREEN_WIDTH / 2, 100, 16, TA_CENTER, colors.lightGrey, app.strings[ST_PAGE], page + 1, (int)maxPages);
if (page > 0)
{
@ -161,7 +161,7 @@ void drawTrophies(void)
}
else
{
drawText(x + 85, y + 20, 20, TA_LEFT, colors.darkGrey, "Hidden");
drawText(x + 85, y + 20, 20, TA_LEFT, colors.darkGrey, app.strings[ST_HIDDEN]);
}
}

View File

@ -177,11 +177,11 @@ void initHub(void)
{
if (game.isComplete)
{
STRNCPY(mission->description, _("As the game is now complete, free play for this mission has been unlocked. You may replay it as often as you wish."), MAX_DESCRIPTION_LENGTH);
STRNCPY(mission->description, app.strings[ST_FREEPLAY], MAX_DESCRIPTION_LENGTH);
}
else if (mission->status == MS_MISSING_HEART_CELL)
{
STRNCPY(mission->description, _("All objectives for this misson have been completed. However, there is a Cell or a Heart left to find. See if you can locate it."), MAX_DESCRIPTION_LENGTH);
STRNCPY(mission->description, app.strings[ST_HEART_CELL], MAX_DESCRIPTION_LENGTH);
}
}
@ -427,17 +427,17 @@ static void drawInfoBar(void)
{
drawRect(0, 0, SCREEN_WIDTH, 32, 0, 0, 0, 192);
drawText(10, 5, 18, TA_LEFT, colors.white, "Missions : %d / %d", game.stats[STAT_MISSIONS_COMPLETE], unlockedMissions);
drawText(10, 5, 18, TA_LEFT, colors.white, app.strings[ST_HUB_MISSIONS], game.stats[STAT_MISSIONS_COMPLETE], unlockedMissions);
drawText(210, 5, 18, TA_LEFT, colors.white, "MIAs : %d / %d", game.stats[STAT_MIAS_RESCUED], game.totalMIAs);
drawText(210, 5, 18, TA_LEFT, colors.white, app.strings[ST_HUB_MIAS], game.stats[STAT_MIAS_RESCUED], game.totalMIAs);
drawText(410, 5, 18, TA_LEFT, colors.white, "Targets : %d / %d", game.stats[STAT_TARGETS_DEFEATED], game.totalTargets);
drawText(410, 5, 18, TA_LEFT, colors.white, app.strings[ST_HUB_TARGETS], game.stats[STAT_TARGETS_DEFEATED], game.totalTargets);
drawText(610, 5, 18, TA_LEFT, colors.white, "Keys : %d / %d", game.stats[STAT_KEYS_FOUND], game.totalKeys);
drawText(610, 5, 18, TA_LEFT, colors.white, app.strings[ST_HUB_KEYS], game.stats[STAT_KEYS_FOUND], game.totalKeys);
drawText(810, 5, 18, TA_LEFT, colors.white, "Hearts : %d / %d", game.stats[STAT_HEARTS_FOUND], game.totalHearts);
drawText(810, 5, 18, TA_LEFT, colors.white, app.strings[ST_HUB_HEARTS], game.stats[STAT_HEARTS_FOUND], game.totalHearts);
drawText(1010, 5, 18, TA_LEFT, colors.white, "Cells : %d / %d", game.stats[STAT_CELLS_FOUND], game.totalCells);
drawText(1010, 5, 18, TA_LEFT, colors.white, app.strings[ST_HUB_CELLS], game.stats[STAT_CELLS_FOUND], game.totalCells);
}
static void drawHudWidgets(void)
@ -676,7 +676,7 @@ static void loadMissions(void)
STRNCPY(mission->id, cJSON_GetObjectItem(node, "id")->valuestring, MAX_NAME_LENGTH);
STRNCPY(mission->name, cJSON_GetObjectItem(node, "name")->valuestring, MAX_NAME_LENGTH);
STRNCPY(mission->description, cJSON_GetObjectItem(node, "description")->valuestring, MAX_DESCRIPTION_LENGTH);
STRNCPY(mission->description, _(cJSON_GetObjectItem(node, "description")->valuestring), MAX_DESCRIPTION_LENGTH);
STRNCPY(mission->requires, cJSON_GetObjectItem(node, "requires")->valuestring, MAX_NAME_LENGTH);
mission->status = MS_LOCKED;

View File

@ -170,7 +170,7 @@ static void draw(void)
blitRectScaled(atlasTexture->texture, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, &background->rect, 0);
drawText(SCREEN_WIDTH / 2, missionCompleteY, 45, TA_CENTER, colors.white, "Mission Complete!");
drawText(SCREEN_WIDTH / 2, missionCompleteY, 45, TA_CENTER, colors.white, app.strings[ST_MISSION_COMPLETE]);
i = 0;
@ -183,12 +183,12 @@ static void draw(void)
for (o = world.objectiveHead.next ; o != NULL ; o = o->next)
{
c = o->required ? colors.red : colors.white;
status = _("Incomplete");
status = app.strings[ST_INCOMPLETE];
if (o->currentValue >= o->targetValue)
{
c = colors.green;
status = _("Complete");
status = app.strings[ST_COMPLETE];
}
drawText(x + 20, y, 24, TA_LEFT, c, o->description);
@ -203,7 +203,7 @@ static void draw(void)
}
}
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 80, 24, TA_CENTER, colors.white, _("Press Fire to Continue"));
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 80, 24, TA_CENTER, colors.white, app.strings[ST_PRESS_FIRE]);
canContinue = 1;
}

View File

@ -354,6 +354,7 @@ typedef struct {
int lastKeyPressed;
int lastButtonPressed;
int restrictTrophyAlert;
char *strings[ST_MAX];
Config config;
} App;

View File

@ -130,6 +130,7 @@ void initGameSystem(void)
{
int i, numInitFuns;
void (*initFuncs[]) (void) = {
initStrings,
initGraphics,
initTextures,
initBackground,

View File

@ -47,6 +47,7 @@ extern void initStats(void);
extern void initTextures(void);
extern void initTrophies(void);
extern void initWidgets(void);
extern void initStrings(void);
extern long lookup(const char *name);
extern void prepareScene(void);
extern void presentScene(void);

93
src/system/strings.c Normal file
View File

@ -0,0 +1,93 @@
/*
Copyright (C) 2018 Parallel Realities
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "strings.h"
void initStrings(void)
{
app.strings[ST_MISSION_COMPLETE] = _("Mission Complete!");
app.strings[ST_OBJECTIVES] = _("Objectives");
app.strings[ST_INCOMPLETE] = _("Incomplete");
app.strings[ST_COMPLETE] = _("Complete");
app.strings[ST_PRESS_FIRE] = _("Press Fire to Continue");
app.strings[ST_OPTIONS] = _("Options");
app.strings[ST_TROPHIES] = _("Trophies");
app.strings[ST_PAGE] = _("Page %d / %d");
app.strings[ST_HIDDEN] = _("Hidden");
app.strings[ST_WEAPON] = _("Weapon: %s");
app.strings[ST_CELL] = _("Found a battery cell - Max power increased!");
app.strings[ST_HEART] = _("Found a heart - Max health increased!");
app.strings[ST_TELEPORTER] = _("Teleporter activated ...");
app.strings[ST_LASERS] = _("Lasers disabled ...");
app.strings[ST_POWER_POINT] = _("Not enough power (%d units required)");
app.strings[ST_LIFT] = _("Platform activated ...");
app.strings[ST_EXIT] = _("Can't exit yet - required objectives not met");
app.strings[ST_LOCKED] = _("Door is locked");
app.strings[ST_OPENED] = _("Door opened ...");
app.strings[ST_GOT_GRENADES] = _("Got some Grenades");
app.strings[ST_PICKED_UP] = _("Picked up a %s");
app.strings[ST_REMOVED] = _("%s removed");
app.strings[ST_REQUIRED] = _("%s required");
app.strings[ST_CANNOT_CARRY] = _("Can't carry any more keys");
app.strings[ST_RESCUED] = _("Rescued %s");
app.strings[ST_JETPACK_POWER] = _("Not enough power for jetpack");
app.strings[ST_AQUALUNG_POWER] = _("Not enough power for aqualung");
app.strings[ST_QUIT_HUB] = _("Quit and return to hub?");
app.strings[ST_QUIT_TUTORIAL] = _("As this is a tutorial mission, you can skip it and move onto the main game.");
app.strings[ST_QUIT_SAVE] = _("Your progress on this mission will be saved.");
app.strings[ST_QUIT_LOSE] = _("Warning: if you quit now, you will lose all progress on this level.");
app.strings[ST_MIAS] = _("MIAs");
app.strings[ST_ITEMS] = _("Items");
app.strings[ST_TARGETS] = _("Targets");
app.strings[ST_OBJECTIVE_COMPLETE] = _("%s - Objective Complete!");
app.strings[ST_CHERRY_BUNCH] = _("bunch of cherries");
app.strings[ST_CHERRY_PAIR] = _("pair of cherries");
app.strings[ST_CHERRY_SMALL] = _("small cherry");
app.strings[ST_BATTERY_FULL] = _("full battery");
app.strings[ST_BATTERY] = _("battery");
app.strings[ST_USED_BATTERY] = _("used battery");
app.strings[ST_WEAK_BATTERY] = _("weak battery");
app.strings[ST_CHOOSE_SAVE] = _("Choose a save slot to use ...");
app.strings[ST_LOAD] = _("Choose a save game to load ...");
app.strings[ST_OVERWRITE_1] = _("Are you sure you want to overwrite this game?");
app.strings[ST_OVERWRITE_2] = _("All progress will be lost!");
app.strings[ST_FREEPLAY] = _("As the game is now complete, free play for this mission has been unlocked. You may replay it as often as you wish.");
app.strings[ST_HEART_CELL] = _("All objectives for this misson have been completed. However, there is a Cell or a Heart left to find. See if you can locate it.");
app.strings[ST_HUB_MISSIONS] = _("Missions: %d / %d");
app.strings[ST_HUB_MIAS] = _("MIAs: %d / %d");
app.strings[ST_HUB_TARGETS] = _("Targets: %d / %d");
app.strings[ST_HUB_KEYS] = _("Keys: %d / %d");
app.strings[ST_HUB_HEARTS] = _("Hearts: %d / %d");
app.strings[ST_HUB_CELLS] = _("Cells: %d / %d");
}

23
src/system/strings.h Normal file
View File

@ -0,0 +1,23 @@
/*
Copyright (C) 2018 Parallel Realities
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "../common.h"
extern App app;

View File

@ -440,7 +440,7 @@ static void loadWidgetGroup(char *filename)
STRNCPY(w->name, cJSON_GetObjectItem(node, "name")->valuestring, MAX_NAME_LENGTH);
STRNCPY(w->group, cJSON_GetObjectItem(node, "group")->valuestring, MAX_NAME_LENGTH);
STRNCPY(w->label, cJSON_GetObjectItem(node, "label")->valuestring, MAX_NAME_LENGTH);
STRNCPY(w->label, _(cJSON_GetObjectItem(node, "label")->valuestring), MAX_NAME_LENGTH);
w->x = cJSON_GetObjectItem(node, "x")->valueint;
w->y = cJSON_GetObjectItem(node, "y")->valueint;
w->w = cJSON_GetObjectItem(node, "w")->valueint;
@ -496,7 +496,7 @@ static void createWidgetOptions(Widget *w, char *options)
w->options = malloc(w->numOptions * sizeof(char*));
i = 0;
option = strtok(options, "|");
option = _(strtok(options, "|"));
while (option)
{
w->options[i] = malloc(strlen(option) + 1);
@ -504,7 +504,7 @@ static void createWidgetOptions(Widget *w, char *options)
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "widget.option[%d] = %s", i, option);
option = strtok(NULL, "|");
option = _(strtok(NULL, "|"));
i++;
}

View File

@ -1,3 +1,23 @@
/*
Copyright (C) 2018 Parallel Realities
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "worldTest.h"
void initWorldTest(char *worldId)

View File

@ -75,7 +75,7 @@ void drawHud(void)
drawOxygen();
drawText(10, 82, 16, TA_LEFT, colors.white, _("Weapon: %s"), getWeaponName(world.bob->weaponType));
drawText(10, 82, 16, TA_LEFT, colors.white, app.strings[ST_WEAPON], getWeaponName(world.bob->weaponType));
if (app.config.inventory)
{
@ -270,19 +270,19 @@ void drawMissionStatus(void)
drawRect(x, (SCREEN_HEIGHT - h) / 2, w, h, 0, 0, 0, 128);
drawOutlineRect(x, (SCREEN_HEIGHT - h) / 2, w, h, 255, 255, 255, 200);
drawText(SCREEN_WIDTH / 2, 100, 40, TA_CENTER, colors.white, _("Objectives"));
drawText(SCREEN_WIDTH / 2, 100, 40, TA_CENTER, colors.white, app.strings[ST_OBJECTIVES]);
y = 180;
for (o = world.objectiveHead.next ; o != NULL ; o = o->next)
{
c = o->required ? colors.red : colors.white;
status = _("Incomplete");
status = app.strings[ST_INCOMPLETE];
if (o->currentValue >= o->targetValue)
{
c = colors.green;
status = _("Complete");
status = app.strings[ST_COMPLETE];
}
drawText(x + 20, y, 24, TA_LEFT, c, o->description);

View File

@ -86,19 +86,19 @@ void dropRandomCherry(int x, int y)
if (r < 1)
{
STRNCPY(i->name, _("bunch of cherries"), MAX_NAME_LENGTH);
STRNCPY(i->name, app.strings[ST_CHERRY_BUNCH], MAX_NAME_LENGTH);
i->value = 10;
i->sprite[0] = i->sprite[1] = i->sprite[2] = cherrySprite[2];
}
else if (r < 10)
{
STRNCPY(i->name, _("pair of cherries"), MAX_NAME_LENGTH);
STRNCPY(i->name, app.strings[ST_CHERRY_PAIR], MAX_NAME_LENGTH);
i->value = 3;
i->sprite[0] = i->sprite[1] = i->sprite[2] = cherrySprite[1];
}
else
{
STRNCPY(i->name, _("small cherry"), MAX_NAME_LENGTH);
STRNCPY(i->name, app.strings[ST_CHERRY_SMALL], MAX_NAME_LENGTH);
i->value = 1;
i->sprite[0] = i->sprite[1] = i->sprite[2] = cherrySprite[0];
}
@ -121,22 +121,22 @@ static void dropBattery(int x, int y)
if (r < 1)
{
STRNCPY(i->name, _("full battery"), MAX_NAME_LENGTH);
STRNCPY(i->name, app.strings[ST_BATTERY_FULL], MAX_NAME_LENGTH);
i->power = 4;
}
else if (r < 10)
{
STRNCPY(i->name, _("battery"), MAX_NAME_LENGTH);
STRNCPY(i->name, app.strings[ST_BATTERY], MAX_NAME_LENGTH);
i->power = 3;
}
else if (r < 25)
{
STRNCPY(i->name, _("used battery"), MAX_NAME_LENGTH);
STRNCPY(i->name, app.strings[ST_USED_BATTERY], MAX_NAME_LENGTH);
i->power = 2;
}
else
{
STRNCPY(i->name, _("weak battery"), MAX_NAME_LENGTH);
STRNCPY(i->name, app.strings[ST_WEAK_BATTERY], MAX_NAME_LENGTH);
i->power = 1;
}

View File

@ -28,4 +28,5 @@ extern Item *initBattery(void);
extern Item *initCherry(void);
extern int rrnd(int low, int high);
extern App app;
extern World world;

View File

@ -117,7 +117,7 @@ void updateObjective(char *targetName)
{
if (o->currentValue == o->targetValue)
{
setGameplayMessage(MSG_OBJECTIVE, _("%s - Objective Complete!"), o->description);
setGameplayMessage(MSG_OBJECTIVE, app.strings[ST_OBJECTIVE_COMPLETE], o->description);
}
else if (o->currentValue < o->targetValue)
{
@ -149,7 +149,7 @@ void updateObjective(char *targetName)
if (world.allObjectivesComplete)
{
setGameplayMessage(MSG_OBJECTIVE, _("Mission Complete!"));
setGameplayMessage(MSG_OBJECTIVE, app.strings[ST_MISSION_COMPLETE]);
}
}
}
@ -173,7 +173,7 @@ void updateHeartCellObjective(void)
{
world.allObjectivesComplete = 1;
setGameplayMessage(MSG_OBJECTIVE, _("Mission Complete!"));
setGameplayMessage(MSG_OBJECTIVE, app.strings[ST_MISSION_COMPLETE]);
}
}

View File

@ -24,5 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern void setGameplayMessage(int type, char *format, ...);
extern App app;
extern Game game;
extern World world;

View File

@ -231,13 +231,13 @@ static void draw(void)
drawMarkers();
drawRect((SCREEN_WIDTH / 2) - 230, SCREEN_HEIGHT - 58, 14, 14, 255, 255, 0, 255);
drawText((SCREEN_WIDTH / 2) - 200, SCREEN_HEIGHT - 65, 20, TA_LEFT, colors.yellow, "MIAs");
drawText((SCREEN_WIDTH / 2) - 200, SCREEN_HEIGHT - 65, 20, TA_LEFT, colors.yellow, app.strings[ST_MIAS]);
drawRect((SCREEN_WIDTH / 2) - 30, SCREEN_HEIGHT - 58, 14, 14, 0, 255, 255, 255);
drawText((SCREEN_WIDTH / 2), SCREEN_HEIGHT - 65, 20, TA_LEFT, colors.cyan, "Items");
drawText((SCREEN_WIDTH / 2), SCREEN_HEIGHT - 65, 20, TA_LEFT, colors.cyan, app.strings[ST_ITEMS]);
drawRect((SCREEN_WIDTH / 2) + 170, SCREEN_HEIGHT - 58, 14, 14, 255, 0, 0, 255);
drawText((SCREEN_WIDTH / 2) + 200, SCREEN_HEIGHT - 65, 20, TA_LEFT, colors.red, "Targets");
drawText((SCREEN_WIDTH / 2) + 200, SCREEN_HEIGHT - 65, 20, TA_LEFT, colors.red, app.strings[ST_TARGETS]);
}
static void drawMap(void)

View File

@ -211,7 +211,7 @@ static void draw(void)
case WS_START:
drawNormal();
drawMissionStatus();
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 80, 24, TA_CENTER, colors.white, _("Press Fire to Continue"));
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 80, 24, TA_CENTER, colors.white, app.strings[ST_PRESS_FIRE]);
break;
case WS_GAME_OVER:
@ -801,19 +801,19 @@ void drawQuit(void)
drawOutlineRect(r.x, r.y, r.w, r.h, 200, 200, 200, 255);
limitTextWidth(r.w - 100);
drawText(SCREEN_WIDTH / 2, r.y + 10, 26, TA_CENTER, colors.white, "Quit and return to hub?");
drawText(SCREEN_WIDTH / 2, r.y + 10, 26, TA_CENTER, colors.white, app.strings[ST_QUIT_HUB]);
if (world.missionType == MT_TRAINING)
{
drawText(SCREEN_WIDTH / 2, r.y + 65, 26, TA_CENTER, colors.white, "As this is a tutorial mission, you can skip it and move onto the main game.");
drawText(SCREEN_WIDTH / 2, r.y + 65, 26, TA_CENTER, colors.white, app.strings[ST_QUIT_TUTORIAL]);
}
else if (world.isReturnVisit)
{
drawText(SCREEN_WIDTH / 2, r.y + 65, 26, TA_CENTER, colors.white, "Your progress on this mission will be saved.");
drawText(SCREEN_WIDTH / 2, r.y + 65, 26, TA_CENTER, colors.white, app.strings[ST_QUIT_SAVE]);
}
else
{
drawText(SCREEN_WIDTH / 2, r.y + 65, 26, TA_CENTER, colors.white, "Warning: if you quit now, you will lose all progress on this level.");
drawText(SCREEN_WIDTH / 2, r.y + 65, 26, TA_CENTER, colors.white, app.strings[ST_QUIT_LOSE]);
}
limitTextWidth(0);

View File

@ -127,7 +127,7 @@ static void loadTriggers(cJSON *root)
STRNCPY(t->name, cJSON_GetObjectItem(node, "name")->valuestring, MAX_NAME_LENGTH);
STRNCPY(t->targetNames, cJSON_GetObjectItem(node, "targetNames")->valuestring, MAX_DESCRIPTION_LENGTH);
STRNCPY(t->message, cJSON_GetObjectItem(node, "message")->valuestring, MAX_DESCRIPTION_LENGTH);
STRNCPY(t->message, _(cJSON_GetObjectItem(node, "message")->valuestring), MAX_DESCRIPTION_LENGTH);
t->x = cJSON_GetObjectItem(node, "x")->valueint;
t->y = cJSON_GetObjectItem(node, "y")->valueint;
t->w = cJSON_GetObjectItem(node, "w")->valueint;