From 73ace650e17de9946bf1e77c1b3c7d3fc2bbb9f2 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 1 Apr 2018 17:41:45 +0100 Subject: [PATCH] i18n updates. --- common.mk | 2 +- src/defs.h | 59 ++++++++++++++++++ src/entities/blobs/bob.c | 4 +- src/entities/blobs/mia.c | 2 +- src/entities/blobs/mia.h | 1 + src/entities/items/battery.c | 2 +- src/entities/items/battery.h | 1 + src/entities/items/cell.c | 2 +- src/entities/items/cell.h | 1 + src/entities/items/cherry.c | 2 +- src/entities/items/cherry.h | 1 + src/entities/items/heart.c | 2 +- src/entities/items/heart.h | 1 + src/entities/items/item.c | 10 +-- src/entities/items/item.h | 1 + src/entities/items/weaponPickup.c | 4 +- src/entities/items/weaponPickup.h | 1 + src/entities/misc/infoPoint.c | 2 +- src/entities/structures/cardReader.c | 4 +- src/entities/structures/cardReader.h | 1 + src/entities/structures/door.c | 8 +-- src/entities/structures/door.h | 1 + src/entities/structures/exit.c | 2 +- src/entities/structures/exit.h | 1 + src/entities/structures/itemPad.c | 4 +- src/entities/structures/itemPad.h | 1 + src/entities/structures/lift.c | 2 +- src/entities/structures/lift.h | 1 + src/entities/structures/powerPoint.c | 2 +- src/entities/structures/powerPoint.h | 1 + src/entities/structures/teleporter.c | 2 +- src/entities/structures/teleporter.h | 1 + src/entities/traps/laserTrap.c | 2 +- src/entities/traps/laserTrap.h | 1 + src/game/ending.c | 2 +- src/game/options.c | 2 +- src/game/title.c | 8 +-- src/game/trophies.c | 6 +- src/hub/hub.c | 18 +++--- src/hub/postMission.c | 8 +-- src/structs.h | 1 + src/system/init.c | 1 + src/system/init.h | 1 + src/system/strings.c | 93 ++++++++++++++++++++++++++++ src/system/strings.h | 23 +++++++ src/system/widgets.c | 6 +- src/test/worldTest.c | 20 ++++++ src/world/hud.c | 8 +-- src/world/items.c | 14 ++--- src/world/items.h | 1 + src/world/objectives.c | 6 +- src/world/objectives.h | 1 + src/world/radar.c | 6 +- src/world/world.c | 10 +-- src/world/worldLoader.c | 2 +- 55 files changed, 292 insertions(+), 77 deletions(-) create mode 100644 src/system/strings.c create mode 100644 src/system/strings.h diff --git a/common.mk b/common.mk index 4e5521e..b8b3893 100644 --- a/common.mk +++ b/common.mk @@ -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 diff --git a/src/defs.h b/src/defs.h index b447950..bd84abe 100644 --- a/src/defs.h +++ b/src/defs.h @@ -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 +}; diff --git a/src/entities/blobs/bob.c b/src/entities/blobs/bob.c index 78d1be5..eb88bba 100644 --- a/src/entities/blobs/bob.c +++ b/src/entities/blobs/bob.c @@ -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]); } } } diff --git a/src/entities/blobs/mia.c b/src/entities/blobs/mia.c index 431e928..4c75dae 100644 --- a/src/entities/blobs/mia.c +++ b/src/entities/blobs/mia.c @@ -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; diff --git a/src/entities/blobs/mia.h b/src/entities/blobs/mia.h index d502b9a..b1dd67a 100644 --- a/src/entities/blobs/mia.h +++ b/src/entities/blobs/mia.h @@ -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; diff --git a/src/entities/items/battery.c b/src/entities/items/battery.c index 76b72da..d013a26 100644 --- a/src/entities/items/battery.c +++ b/src/entities/items/battery.c @@ -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(); diff --git a/src/entities/items/battery.h b/src/entities/items/battery.h index 444f32d..e7da3b2 100644 --- a/src/entities/items/battery.h +++ b/src/entities/items/battery.h @@ -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; diff --git a/src/entities/items/cell.c b/src/entities/items/cell.c index 70d5d55..5162ed8 100644 --- a/src/entities/items/cell.c +++ b/src/entities/items/cell.c @@ -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); diff --git a/src/entities/items/cell.h b/src/entities/items/cell.h index 8eb3ae6..00ece5f 100644 --- a/src/entities/items/cell.h +++ b/src/entities/items/cell.h @@ -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; diff --git a/src/entities/items/cherry.c b/src/entities/items/cherry.c index 9d5f1ce..f418b68 100644 --- a/src/entities/items/cherry.c +++ b/src/entities/items/cherry.c @@ -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(); diff --git a/src/entities/items/cherry.h b/src/entities/items/cherry.h index 6606c08..a1ea2f1 100644 --- a/src/entities/items/cherry.h +++ b/src/entities/items/cherry.h @@ -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; diff --git a/src/entities/items/heart.c b/src/entities/items/heart.c index 26dd934..cd926e9 100644 --- a/src/entities/items/heart.c +++ b/src/entities/items/heart.c @@ -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); diff --git a/src/entities/items/heart.h b/src/entities/items/heart.h index 2ba258a..bd7b59a 100644 --- a/src/entities/items/heart.h +++ b/src/entities/items/heart.h @@ -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; diff --git a/src/entities/items/item.c b/src/entities/items/item.c index e728c33..00c25ff 100644 --- a/src/entities/items/item.c +++ b/src/entities/items/item.c @@ -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); diff --git a/src/entities/items/item.h b/src/entities/items/item.h index 5d6cb00..5e8161f 100644 --- a/src/entities/items/item.h +++ b/src/entities/items/item.h @@ -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; diff --git a/src/entities/items/weaponPickup.c b/src/entities/items/weaponPickup.c index b105481..56014dc 100644 --- a/src/entities/items/weaponPickup.c +++ b/src/entities/items/weaponPickup.c @@ -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; } diff --git a/src/entities/items/weaponPickup.h b/src/entities/items/weaponPickup.h index 366ab3a..ff8b80a 100644 --- a/src/entities/items/weaponPickup.h +++ b/src/entities/items/weaponPickup.h @@ -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; diff --git a/src/entities/misc/infoPoint.c b/src/entities/misc/infoPoint.c index 0d401a7..2ab1182 100644 --- a/src/entities/misc/infoPoint.c +++ b/src/entities/misc/infoPoint.c @@ -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) diff --git a/src/entities/structures/cardReader.c b/src/entities/structures/cardReader.c index 82742a8..1666353 100644 --- a/src/entities/structures/cardReader.c +++ b/src/entities/structures/cardReader.c @@ -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); } diff --git a/src/entities/structures/cardReader.h b/src/entities/structures/cardReader.h index 13c70f2..712816a 100644 --- a/src/entities/structures/cardReader.h +++ b/src/entities/structures/cardReader.h @@ -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; diff --git a/src/entities/structures/door.c b/src/entities/structures/door.c index 76e2cfd..9d15f7d 100644 --- a/src/entities/structures/door.c +++ b/src/entities/structures/door.c @@ -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]); } } } diff --git a/src/entities/structures/door.h b/src/entities/structures/door.h index 878f780..e54ebe0 100644 --- a/src/entities/structures/door.h +++ b/src/entities/structures/door.h @@ -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; diff --git a/src/entities/structures/exit.c b/src/entities/structures/exit.c index 53fde2c..b2bec50 100644 --- a/src/entities/structures/exit.c +++ b/src/entities/structures/exit.c @@ -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]); } } diff --git a/src/entities/structures/exit.h b/src/entities/structures/exit.h index bfb7b0b..108ce54 100644 --- a/src/entities/structures/exit.h +++ b/src/entities/structures/exit.h @@ -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; diff --git a/src/entities/structures/itemPad.c b/src/entities/structures/itemPad.c index 0c89dd8..2b3ff82 100644 --- a/src/entities/structures/itemPad.c +++ b/src/entities/structures/itemPad.c @@ -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; diff --git a/src/entities/structures/itemPad.h b/src/entities/structures/itemPad.h index 4ece4a6..f1ed392 100644 --- a/src/entities/structures/itemPad.h +++ b/src/entities/structures/itemPad.h @@ -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; diff --git a/src/entities/structures/lift.c b/src/entities/structures/lift.c index 85cce24..409f9b2 100644 --- a/src/entities/structures/lift.c +++ b/src/entities/structures/lift.c @@ -125,7 +125,7 @@ static void activate(int active) if (!isOnScreen(self)) { - setGameplayMessage(MSG_GAMEPLAY, _("Platform activated ...")); + setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_LIFT]); } } } diff --git a/src/entities/structures/lift.h b/src/entities/structures/lift.h index e5593d7..343625e 100644 --- a/src/entities/structures/lift.h +++ b/src/entities/structures/lift.h @@ -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; diff --git a/src/entities/structures/powerPoint.c b/src/entities/structures/powerPoint.c index a26d142..de0e052 100644 --- a/src/entities/structures/powerPoint.c +++ b/src/entities/structures/powerPoint.c @@ -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 { diff --git a/src/entities/structures/powerPoint.h b/src/entities/structures/powerPoint.h index 9847a2d..2263e34 100644 --- a/src/entities/structures/powerPoint.h +++ b/src/entities/structures/powerPoint.h @@ -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; diff --git a/src/entities/structures/teleporter.c b/src/entities/structures/teleporter.c index 5672319..457e208 100644 --- a/src/entities/structures/teleporter.c +++ b/src/entities/structures/teleporter.c @@ -118,7 +118,7 @@ static void activate(int active) if (!isOnScreen(self)) { - setGameplayMessage(MSG_GAMEPLAY, _("Teleporter activated ...")); + setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_TELEPORTER]); } } } diff --git a/src/entities/structures/teleporter.h b/src/entities/structures/teleporter.h index 53346d4..daa1597 100644 --- a/src/entities/structures/teleporter.h +++ b/src/entities/structures/teleporter.h @@ -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; diff --git a/src/entities/traps/laserTrap.c b/src/entities/traps/laserTrap.c index ab69e83..b3a3000 100644 --- a/src/entities/traps/laserTrap.c +++ b/src/entities/traps/laserTrap.c @@ -178,7 +178,7 @@ static void activate(int active) if (!isOnScreen(self)) { - setGameplayMessage(MSG_GAMEPLAY, _("Lasers disabled ...")); + setGameplayMessage(MSG_GAMEPLAY, app.strings[ST_LASERS]); } } } diff --git a/src/entities/traps/laserTrap.h b/src/entities/traps/laserTrap.h index cc5a1cb..f05cf87 100644 --- a/src/entities/traps/laserTrap.h +++ b/src/entities/traps/laserTrap.h @@ -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; diff --git a/src/game/ending.c b/src/game/ending.c index 4ec297f..44a1cda 100644 --- a/src/game/ending.c +++ b/src/game/ending.c @@ -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"); } diff --git a/src/game/options.c b/src/game/options.c index 94b1d9e..c1cc97c 100644 --- a/src/game/options.c +++ b/src/game/options.c @@ -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); diff --git a/src/game/title.c b/src/game/title.c index bf28590..9848cb3 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -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]); } } diff --git a/src/game/trophies.c b/src/game/trophies.c index 5ae5e8d..8312dd7 100644 --- a/src/game/trophies.c +++ b/src/game/trophies.c @@ -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]); } } diff --git a/src/hub/hub.c b/src/hub/hub.c index 21ecade..9dffdfe 100644 --- a/src/hub/hub.c +++ b/src/hub/hub.c @@ -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; diff --git a/src/hub/postMission.c b/src/hub/postMission.c index 7e19fb8..19a0713 100644 --- a/src/hub/postMission.c +++ b/src/hub/postMission.c @@ -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; } diff --git a/src/structs.h b/src/structs.h index 3be175c..117c9a5 100644 --- a/src/structs.h +++ b/src/structs.h @@ -354,6 +354,7 @@ typedef struct { int lastKeyPressed; int lastButtonPressed; int restrictTrophyAlert; + char *strings[ST_MAX]; Config config; } App; diff --git a/src/system/init.c b/src/system/init.c index 189bdba..cc31f0f 100644 --- a/src/system/init.c +++ b/src/system/init.c @@ -130,6 +130,7 @@ void initGameSystem(void) { int i, numInitFuns; void (*initFuncs[]) (void) = { + initStrings, initGraphics, initTextures, initBackground, diff --git a/src/system/init.h b/src/system/init.h index 176cae7..30edc42 100644 --- a/src/system/init.h +++ b/src/system/init.h @@ -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); diff --git a/src/system/strings.c b/src/system/strings.c new file mode 100644 index 0000000..288f158 --- /dev/null +++ b/src/system/strings.c @@ -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"); +} diff --git a/src/system/strings.h b/src/system/strings.h new file mode 100644 index 0000000..2ed81bd --- /dev/null +++ b/src/system/strings.h @@ -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; diff --git a/src/system/widgets.c b/src/system/widgets.c index c0599a1..57b5874 100644 --- a/src/system/widgets.c +++ b/src/system/widgets.c @@ -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++; } diff --git a/src/test/worldTest.c b/src/test/worldTest.c index c8ccb9d..d5fbe34 100644 --- a/src/test/worldTest.c +++ b/src/test/worldTest.c @@ -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) diff --git a/src/world/hud.c b/src/world/hud.c index f5afa7d..1c2ed79 100644 --- a/src/world/hud.c +++ b/src/world/hud.c @@ -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); diff --git a/src/world/items.c b/src/world/items.c index 3e1e937..9995e6b 100644 --- a/src/world/items.c +++ b/src/world/items.c @@ -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; } diff --git a/src/world/items.h b/src/world/items.h index 745a34b..13f7a89 100644 --- a/src/world/items.h +++ b/src/world/items.h @@ -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; diff --git a/src/world/objectives.c b/src/world/objectives.c index bf0a9eb..be0a9c4 100644 --- a/src/world/objectives.c +++ b/src/world/objectives.c @@ -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]); } } diff --git a/src/world/objectives.h b/src/world/objectives.h index 9beef1b..89d7eb2 100644 --- a/src/world/objectives.h +++ b/src/world/objectives.h @@ -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; diff --git a/src/world/radar.c b/src/world/radar.c index d3c5310..40e6f51 100644 --- a/src/world/radar.c +++ b/src/world/radar.c @@ -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) diff --git a/src/world/world.c b/src/world/world.c index a6806d8..f97772b 100644 --- a/src/world/world.c +++ b/src/world/world.c @@ -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); diff --git a/src/world/worldLoader.c b/src/world/worldLoader.c index 3a0ab68..a1b2db7 100644 --- a/src/world/worldLoader.c +++ b/src/world/worldLoader.c @@ -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;