From d3319ad6a8529683c00ce714e5dfa453bba4f1cb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 Jan 2009 05:49:18 +0000 Subject: Introduced a static string list for language dependant strings, and changed the options and inventory menus to use it svn-id: r36051 --- engines/cruise/cruise_main.cpp | 4 +++- engines/cruise/menu.cpp | 16 +++++++++----- engines/cruise/module.mk | 1 + engines/cruise/staticres.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++ engines/cruise/staticres.h | 39 ++++++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 engines/cruise/staticres.cpp create mode 100644 engines/cruise/staticres.h diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 0057d688b2..a8e38f2143 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -29,6 +29,7 @@ #include "cruise/cruise_main.h" #include "cruise/cell.h" +#include "cruise/staticres.h" namespace Cruise { @@ -774,7 +775,8 @@ int getObjectClass(int overlayIdx, int objIdx) { void buildInventory(int X, int Y) { menuStruct *pMenu; - pMenu = createMenu(X, Y, "Inventaire"); + const char **sl = getStringList(); + pMenu = createMenu(X, Y, sl[SL_INVENTORY]); menuTable[1] = pMenu; if (pMenu == NULL) diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp index 8553cb35c2..af1b1827d2 100644 --- a/engines/cruise/menu.cpp +++ b/engines/cruise/menu.cpp @@ -24,6 +24,7 @@ */ #include "cruise/cruise_main.h" +#include "cruise/staticres.h" namespace Cruise { @@ -235,16 +236,19 @@ int playerMenu(int menuX, int menuY) { linkedRelation = 0; */ freeDisk(); - menuTable[0] = createMenu(menuX, menuY, "Menu Joueur"); + // Get the correct string set to use + const char **sl = getStringList(); + + menuTable[0] = createMenu(menuX, menuY, sl[SL_MENU]); ASSERT(menuTable[0]); - //addSelectableMenuEntry(0, 3, menuTable[0], 1, -1, "Lecteur de Sauvegarde"); + //addSelectableMenuEntry(0, 3, menuTable[0], 1, -1, "Save game disk"); if (userEnabled) { - addSelectableMenuEntry(0, 4, menuTable[0], 1, -1, "Sauvegarde"); + addSelectableMenuEntry(0, 4, menuTable[0], 1, -1, sl[SL_SAVE]); } - addSelectableMenuEntry(0, 5, menuTable[0], 1, -1, "Chargement"); - addSelectableMenuEntry(0, 6, menuTable[0], 1, -1, "Recommencer le jeu"); - addSelectableMenuEntry(0, 7, menuTable[0], 1, -1, "Quitter"); + addSelectableMenuEntry(0, 5, menuTable[0], 1, -1, sl[SL_LOAD]); + addSelectableMenuEntry(0, 6, menuTable[0], 1, -1, sl[SL_RESTART]); + addSelectableMenuEntry(0, 7, menuTable[0], 1, -1, sl[SL_QUIT]); retourMenu = processMenu(menuTable[0]); diff --git a/engines/cruise/module.mk b/engines/cruise/module.mk index 8db5b1da44..75548cd1ec 100644 --- a/engines/cruise/module.mk +++ b/engines/cruise/module.mk @@ -27,6 +27,7 @@ MODULE_OBJS := \ saveload.o \ script.o \ stack.o \ + staticres.o \ various.o \ vars.o \ volume.o diff --git a/engines/cruise/staticres.cpp b/engines/cruise/staticres.cpp new file mode 100644 index 0000000000..b3174414f3 --- /dev/null +++ b/engines/cruise/staticres.cpp @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "cruise/staticres.h" +#include "cruise/cruise.h" +#include "common/util.h" + +namespace Cruise { + +const char *english_strings[] = { + "Player Menu", "Save", "Load", "Start again", "Quit", "Inventory" +}; +const char *french_strings[] = { + "Menu Joueur", "Sauvegarde", "Chargement", "Recommencer le jeu", "Quitter", "Inventaire" +}; + +const char **getStringList() { + switch (_vm->getLanguage()) { + case Common::EN_ANY: + return english_strings; + case Common::FR_FRA: + return french_strings; + default: + error("Unknown language encountered"); + } +} + +} // End of namespace Cruise diff --git a/engines/cruise/staticres.h b/engines/cruise/staticres.h new file mode 100644 index 0000000000..d11a57e161 --- /dev/null +++ b/engines/cruise/staticres.h @@ -0,0 +1,39 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#ifndef CRUISE_STATICRES_H +#define CRUISE_STATICRES_H + +namespace Cruise { + +enum MenuConstants { + SL_MENU, SL_SAVE, SL_LOAD, SL_RESTART, SL_QUIT, SL_INVENTORY +}; + +const char **getStringList(); + +} // End of namespace Cruise + +#endif -- cgit v1.2.3