aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorOystein Eftevaag2006-04-23 14:43:16 +0000
committerOystein Eftevaag2006-04-23 14:43:16 +0000
commitf25cb2e7356bc6c5ffda6e2cb3b18206c8377e24 (patch)
tree358c4fd25f8ac82d0ccd5272b287cae5b86a8224 /engines/kyra
parent8e9c2e7508a441550fd2c9545ab1ccbd302a2829 (diff)
downloadscummvm-rg350-f25cb2e7356bc6c5ffda6e2cb3b18206c8377e24.tar.gz
scummvm-rg350-f25cb2e7356bc6c5ffda6e2cb3b18206c8377e24.tar.bz2
scummvm-rg350-f25cb2e7356bc6c5ffda6e2cb3b18206c8377e24.zip
Uses kyra.dat for GUI strings instead of hardcoding them, which means localized strings are now supported for the menus. Note that the size of the menus are not yet calculated to account for the longer strings in some languages
svn-id: r22105
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/gui.cpp137
-rw-r--r--engines/kyra/kyra.h16
-rw-r--r--engines/kyra/resource.h6
-rw-r--r--engines/kyra/staticres.cpp55
4 files changed, 164 insertions, 50 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index 40fb93f1e3..1fba2155c0 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -405,10 +405,95 @@ int KyraEngine::drawShadedBoxCallback(Button *button) {
return 0;
}
+void KyraEngine::setGUILabels() {
+ int offset = 0;
+ int walkspeedGarbageOffset = 36;
+
+ if (_features & GF_TALKIE) {
+ if (_features & GF_ENGLISH) {
+ offset = 52;
+ } else if (_features & GF_GERMAN) {
+ offset = 30;
+ } else if (_features & GF_FRENCH) {
+ offset = 6;
+ }
+ walkspeedGarbageOffset = 48;
+ }
+
+ assert(offset + 27 < _guiStringsSize);
+
+ // The Legend of Kyrandia
+ _menu[0].menuName = _guiStrings[0];
+ // Load a Game
+ _menu[0].item[0].itemString = _guiStrings[1];
+ // Save a Game
+ _menu[0].item[1].itemString = _guiStrings[2];
+ // Game controls
+ _menu[0].item[2].itemString = _guiStrings[3];
+ // Quit playing
+ _menu[0].item[3].itemString = _guiStrings[4];
+ // Resume game
+ _menu[0].item[4].itemString = _guiStrings[5];
+
+ // Cancel
+ _menu[2].item[5].itemString = _guiStrings[10];
+
+ // Enter a description of your saved game:
+ _menu[3].menuName = _guiStrings[11];
+ // Save
+ _menu[3].item[0].itemString = _guiStrings[12];
+ // Cancel
+ _menu[3].item[1].itemString = _guiStrings[10];
+
+ // Rest in peace, Brandon
+ _menu[4].menuName = _guiStrings[13];
+ // Load a game
+ _menu[4].item[0].itemString = _guiStrings[1];
+ // Quit playing
+ _menu[4].item[1].itemString = _guiStrings[4];
+
+ // Game Controls
+ _menu[5].menuName = _guiStrings[6];
+ // Yes
+ _menu[1].item[0].itemString = _guiStrings[22 + offset];
+ // No
+ _menu[1].item[1].itemString = _guiStrings[23 + offset];
+
+ // Music is
+ _menu[5].item[0].labelString = _guiStrings[26 + offset];
+ // Sounds are
+ _menu[5].item[1].labelString = _guiStrings[27 + offset];
+ // Walk speed
+ _menu[5].item[2].labelString = &_guiStrings[24 + offset][walkspeedGarbageOffset];
+ // Text speed
+ _menu[5].item[4].labelString = _guiStrings[25 + offset];
+ // Main Menu
+ _menu[5].item[5].itemString = _guiStrings[19 + offset];
+
+ if (_features & GF_TALKIE) {
+ // Text & Voice
+ _voiceTextString = _guiStrings[28 + offset];
+ }
+ _textSpeedString = _guiStrings[25 + offset];
+ _onString = _guiStrings[20 + offset];
+ _offString = _guiStrings[21 + offset];
+}
+
int KyraEngine::buttonMenuCallback(Button *caller) {
_displayMenu = true;
- // XXX setLabels
+ assert(_guiStrings);
+ assert(_configStrings);
+
+ /*
+ for (int i = 0; i < _guiStringsSize; i++)
+ debug("GUI string %i: %s", i, _guiStrings[i]);
+
+ for (int i = 0; i < _configStringsSize; i++)
+ debug("Config string %i: %s", i, _configStrings[i]);
+ */
+
+ setGUILabels();
if (_currentCharacter->sceneId == 210 && _deathHandler == 0xFF) {
snd_playSoundEffect(0x36);
return 0;
@@ -685,8 +770,8 @@ int KyraEngine::gui_saveGameMenu(Button *button) {
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
_screen->savePageToDisk("SEENPAGE.TMP", 0);
- _menu[2].menuName = "Select a position to save to:";
- _specialSavegameString = "[ EMPTY SLOT ]";
+ _menu[2].menuName = _guiStrings[8]; // Select a position to save to:
+ _specialSavegameString = _guiStrings[9]; // [ EMPTY SLOT ]
for (int i = 0; i < 5; i++)
_menu[2].item[i].callback = &KyraEngine::gui_saveGame;
@@ -729,8 +814,8 @@ int KyraEngine::gui_loadGameMenu(Button *button) {
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
_screen->savePageToDisk("SEENPAGE.TMP", 0);
- _specialSavegameString = "[ START A NEW GAME ]";
- _menu[2].menuName = "Which game would you like to reload?";
+ _specialSavegameString = _newGameString[0]; //[ START A NEW GAME ]
+ _menu[2].menuName = _guiStrings[7]; // Which game would you like to reload?
for (int i = 0; i < 5; i++)
_menu[2].item[i].callback = &KyraEngine::gui_loadGame;
@@ -879,7 +964,7 @@ int KyraEngine::gui_quitPlaying(Button *button) {
debugC(9, kDebugLevelGUI, "KyraEngine::gui_quitPlaying()");
processMenuButton(button);
- if (gui_quitConfirm("Are you sure you want to quit playing?"))
+ if (gui_quitConfirm(_guiStrings[14])) // Are you sure you want to quit playing?
quitGame();
else {
initMenu(_menu[_toplevelMenu]);
@@ -946,14 +1031,14 @@ int KyraEngine::gui_gameControlsMenu(Button *button) {
_menu[5].item[i].width = 94;
}
- _menu[5].item[3].labelString = "Voice / Text ";
+ _menu[5].item[3].labelString = _voiceTextString; //"Voice / Text "
_menu[5].item[3].callback = &KyraEngine::gui_controlsChangeVoice;
} else {
_menu[5].height = 136;
_menu[5].item[5].y = 110;
_menu[5].item[4].enabled = 0;
- _menu[5].item[3].labelString = "Text speed ";
+ _menu[5].item[3].labelString = _textSpeedString; // "Text speed "
_menu[5].item[3].callback = &KyraEngine::gui_controlsChangeText;
}
@@ -985,40 +1070,42 @@ void KyraEngine::gui_setupControls(Menu &menu) {
debugC(9, kDebugLevelGUI, "KyraEngine::gui_setupControls()");
if (_configMusic)
- menu.item[0].itemString = "On";
+ menu.item[0].itemString = _onString; //"On"
else
- menu.item[0].itemString = "Off";
+ menu.item[0].itemString = _offString; //"Off"
if (_configSounds)
- menu.item[1].itemString = "On";
+ menu.item[1].itemString = _onString; //"On"
else
- menu.item[1].itemString = "Off";
+ menu.item[1].itemString = _offString; //"Off"
switch (_configWalkspeed) {
case 0:
- menu.item[2].itemString = "Slowest";
+ menu.item[2].itemString = _configStrings[0]; //"Slowest"
break;
case 1:
- menu.item[2].itemString = "Slow";
+ menu.item[2].itemString = _configStrings[1]; //"Slow"
break;
case 2:
- menu.item[2].itemString = "Normal";
+ menu.item[2].itemString = _configStrings[2]; //"Normal"
break;
case 3:
- menu.item[2].itemString = "Fast";
+ menu.item[2].itemString = _configStrings[3]; //"Fast"
break;
case 4:
- menu.item[2].itemString = "Fastest";
+ menu.item[2].itemString = _configStrings[4]; //"Fastest"
break;
default:
menu.item[2].itemString = "ERROR";
}
int textControl = 3;
+ int clickableOffset = 8;
if (_features & GF_TALKIE) {
textControl = 4;
-
+ clickableOffset = 11;
+
if (_configVoice == 0)
_menu[5].item[4].enabled = 1;
else
@@ -1026,13 +1113,13 @@ void KyraEngine::gui_setupControls(Menu &menu) {
switch (_configVoice) {
case 0:
- menu.item[3].itemString = "Text only";
+ menu.item[3].itemString = _configStrings[5]; //"Text only"
break;
case 1:
- menu.item[3].itemString = "Voice & Text";
+ menu.item[3].itemString = _configStrings[6]; //"Voice & Text"
break;
case 2:
- menu.item[3].itemString = "Voice only";
+ menu.item[3].itemString = _configStrings[7]; //"Voice only"
break;
default:
menu.item[3].itemString = "ERROR";
@@ -1041,16 +1128,16 @@ void KyraEngine::gui_setupControls(Menu &menu) {
switch (_configTextspeed) {
case 0:
- menu.item[textControl].itemString = "Slow";
+ menu.item[textControl].itemString = _configStrings[1]; //"Slow"
break;
case 1:
- menu.item[textControl].itemString = "Normal";
+ menu.item[textControl].itemString = _configStrings[2]; //"Normal"
break;
case 2:
- menu.item[textControl].itemString = "Fast";
+ menu.item[textControl].itemString = _configStrings[3]; //"Fast"
break;
case 3:
- menu.item[textControl].itemString = "Clickable";
+ menu.item[textControl].itemString = _configStrings[clickableOffset]; //"Clickable"
break;
default:
menu.item[textControl].itemString = "ERROR";
diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h
index d5a26f9c19..9357aaecb5 100644
--- a/engines/kyra/kyra.h
+++ b/engines/kyra/kyra.h
@@ -635,7 +635,8 @@ protected:
int drawShadedBoxCallback(Button *button);
void calcCoords(Menu &menu);
void initMenu(Menu menu);
-
+ void setGUILabels();
+
Button *initButton(Button *list, Button *newButton);
void processButtonList(Button *list);
void processButton(Button *button);
@@ -873,7 +874,13 @@ protected:
const char * const*_fullFlask;
const char * const*_veryClever;
const char * const*_homeString;
+ const char * const*_newGameString;
+ const char *_voiceTextString;
+ const char *_textSpeedString;
+ const char *_onString;
+ const char *_offString;
+
int _itemList_Size;
int _takenList_Size;
int _placedList_Size;
@@ -892,9 +899,16 @@ protected:
int _fullFlask_Size;
int _veryClever_Size;
int _homeString_Size;
+ int _newGameString_Size;
const char * const*_characterImageTable;
int _characterImageTableSize;
+
+ const char * const*_guiStrings;
+ int _guiStringsSize;
+
+ const char * const*_configStrings;
+ int _configStringsSize;
Shape *_defaultShapeTable;
int _defaultShapeTableSize;
diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h
index e608b26d70..702f6a7d35 100644
--- a/engines/kyra/resource.h
+++ b/engines/kyra/resource.h
@@ -139,7 +139,8 @@ enum kKyraResources {
kFullFlaskString,
kVeryCleverString,
-
+ kNewGameString,
+
kDefaultShapes,
kHealing1Shapes,
kHealing2Shapes,
@@ -155,6 +156,9 @@ enum kKyraResources {
kPaletteList,
+ kGUIStrings,
+ kConfigStrings,
+
kMaxResIDs
};
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index fdca8567b3..6a3e3cb523 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -28,7 +28,7 @@
namespace Kyra {
-#define RESFILE_VERSION 11
+#define RESFILE_VERSION 12
#define GAME_FLAGS (GF_FLOPPY | GF_TALKIE | GF_DEMO | GF_AUDIOCD)
#define LANGUAGE_FLAGS (GF_ENGLISH | GF_FRENCH | GF_GERMAN | GF_SPANISH | GF_LNGUNK)
@@ -100,7 +100,12 @@ bool StaticResource::init() {
{ kFlaskFullString, kLanguageList, "FLASKFULL." },
{ kFullFlaskString, kLanguageList, "FULLFLASK." },
{ kVeryCleverString, kLanguageList, "VERYCLEVER." },
+ { kNewGameString, kLanguageList, "NEWGAME." },
+ // GUI strings table
+ { kGUIStrings, kLanguageList, "GUISTRINGS." },
+ { kConfigStrings, kLanguageList, "CONFIGSTRINGS." },
+
// ROOM table/filenames
{ Kyra::kRoomList, StaticResource::kRoomList, "ROOM-TABLE.ROOM" },
{ kRoomFilenames, kStringList, "ROOM-FILENAMES.TXT" },
@@ -567,7 +572,8 @@ void KyraEngine::initStaticResource() {
_fullFlask = _staticres->loadStrings(kFullFlaskString, _fullFlask_Size);
_veryClever = _staticres->loadStrings(kVeryCleverString, _veryClever_Size);
_homeString = _staticres->loadStrings(kOutroHomeString, _homeString_Size);
-
+ _newGameString = _staticres->loadStrings(kNewGameString, _newGameString_Size);
+
_healingShapeTable = _staticres->loadShapeTable(kHealing1Shapes, _healingShapeTableSize);
_healingShape2Table = _staticres->loadShapeTable(kHealing2Shapes, _healingShape2TableSize);
_posionDeathShapeTable = _staticres->loadShapeTable(kPoisonDeathShapes, _posionDeathShapeTableSize);
@@ -588,6 +594,9 @@ void KyraEngine::initStaticResource() {
_specialPalettes = _staticres->loadPaletteTable(kPaletteList, temp);
+ _guiStrings = _staticres->loadStrings(kGUIStrings, _guiStringsSize);
+ _configStrings = _staticres->loadStrings(kConfigStrings, _configStringsSize);
+
// copied static res
// room list
@@ -1067,30 +1076,30 @@ Button KyraEngine::_menuButtonData[] = {
};
Menu KyraEngine::_menu[] = {
- { -1, -1, 208, 136, 248, 249, 250, "The Legend of Kyrandia", 251, -1, 8, 0, 5, -1, -1, -1, -1,
+ { -1, -1, 208, 136, 248, 249, 250, 0, 251, -1, 8, 0, 5, -1, -1, -1, -1,
{
- {1, 0, 0, "Load a Game", -1, -1, 30, 148, 15, 252, 253, 24, 0,
+ {1, 0, 0, 0, -1, -1, 30, 148, 15, 252, 253, 24, 0,
248, 249, 250, &KyraEngine::gui_loadGameMenu, -1, 0, 0, 0, 0, 0},
- {1, 0, 0, "Save this Game", -1, -1, 47, 148, 15, 252, 253, 24, 0,
+ {1, 0, 0, 0, -1, -1, 47, 148, 15, 252, 253, 24, 0,
248, 249, 250, &KyraEngine::gui_saveGameMenu, -1, 0, 0, 0, 0, 0},
- {1, 0, 0, "Game Controls", -1, -1, 64, 148, 15, 252, 253, 24, 0,
+ {1, 0, 0, 0, -1, -1, 64, 148, 15, 252, 253, 24, 0,
248, 249, 250, &KyraEngine::gui_gameControlsMenu, -1, 0, 0, 0, 0, 0},
- {1, 0, 0, "Quit playing", -1, -1, 81, 148, 15, 252, 253, 24, 0,
+ {1, 0, 0, 0, -1, -1, 81, 148, 15, 252, 253, 24, 0,
248, 249, 250, &KyraEngine::gui_quitPlaying, -1, 0, 0, 0, 0, 0},
- {1, 0, 0, "Resume game", 86, 0, 110, 92, 15, 252, 253, -1, 255,
+ {1, 0, 0, 0, 86, 0, 110, 92, 15, 252, 253, -1, 255,
248, 249, 250, &KyraEngine::gui_resumeGame, -1, 0, 0, 0, 0, 0}
}
},
{ -1, -1, 288, 56, 248, 249, 250, 0, 254,-1, 8, 0, 2, -1, -1, -1, -1,
{
- {1, 0, 0, "Yes", 24, 0, 30, 72, 15, 252, 253, -1, 255,
+ {1, 0, 0, 0, 24, 0, 30, 72, 15, 252, 253, -1, 255,
248, 249, 250, &KyraEngine::gui_quitConfirmYes, -1, 0, 0, 0, 0, 0},
- {1, 0, 0, "No", 192, 0, 30, 72, 15, 252, 253, -1, 255,
+ {1, 0, 0, 0, 192, 0, 30, 72, 15, 252, 253, -1, 255,
248, 249, 250, &KyraEngine::gui_quitConfirmNo, -1, 0, 0, 0, 0, 0}
}
},
@@ -1111,46 +1120,46 @@ Menu KyraEngine::_menu[] = {
{1, 0, 0, 0, -1, 255, 107, 256, 15, 252, 253, 5, 0,
248, 249, 250, 0, -1, 0, 0, 0, 0, 0},
- {1, 0, 0, "Cancel", 184, 0, 134, 88, 15, 252, 253, -1, 255,
+ {1, 0, 0, 0, 184, 0, 134, 88, 15, 252, 253, -1, 255,
248, 249, 250, &KyraEngine::gui_cancelSubMenu, -1, 0, 0, 0, 0, 0},
}
},
- { -1, -1, 288, 67, 248, 249, 250, "Enter a description of your saved game:", 251, -1, 8, 0, 3, -1, -1, -1, -1,
+ { -1, -1, 288, 67, 248, 249, 250, 0, 251, -1, 8, 0, 3, -1, -1, -1, -1,
{
- {1, 0, 0, "Save", 24, 0, 44, 72, 15, 252, 253, -1, 255,
+ {1, 0, 0, 0, 24, 0, 44, 72, 15, 252, 253, -1, 255,
248, 249, 250, &KyraEngine::gui_savegameConfirm, -1, 0, 0, 0, 0, 0},
- {1, 0, 0, "Cancel", 192, 0, 44, 72, 15, 252, 253, -1, 255,
+ {1, 0, 0, 0, 192, 0, 44, 72, 15, 252, 253, -1, 255,
248, 249, 250, &KyraEngine::gui_cancelSubMenu, -1, 0, 0, 0, 0, 0}
}
},
- { -1, -1, 208, 76, 248, 249, 250, "Rest in peace, Brandon.", 251, -1, 8, 0, 2, -1, -1, -1, -1,
+ { -1, -1, 208, 76, 248, 249, 250, 0, 251, -1, 8, 0, 2, -1, -1, -1, -1,
{
- {1, 0, 0, "Load a game", -1, -1, 30, 148, 15, 252, 253, 24, 0,
+ {1, 0, 0, 0, -1, -1, 30, 148, 15, 252, 253, 24, 0,
248, 249, 250, &KyraEngine::gui_loadGameMenu, -1, 0, 0, 0, 0, 0},
- {1, 0, 0, "Quit playing", -1, -1, 47, 148, 15, 252, 253, 24, 0,
+ {1, 0, 0, 0, -1, -1, 47, 148, 15, 252, 253, 24, 0,
248, 249, 250, &KyraEngine::gui_quitPlaying, -1, 0, 0, 0, 0, 0}
}
},
- { -1, -1, 208, 153, 248, 249, 250, "Game Controls", 251, -1, 8, 0, 6, -1, -1, -1, -1,
+ { -1, -1, 208, 153, 248, 249, 250, 0, 251, -1, 8, 0, 6, -1, -1, -1, -1,
{
{1, 0, 0, 0, 110, 0, 30, 64, 15, 252, 253, 5, 0,
- 248, 249, 250, &KyraEngine::gui_controlsChangeMusic, -1, "Music is ", 34, 32, 0, 0},
+ 248, 249, 250, &KyraEngine::gui_controlsChangeMusic, -1, 0, 34, 32, 0, 0},
{1, 0, 0, 0, 110, 0, 47, 64, 15, 252, 253, 5, 0,
- 248, 249, 250, &KyraEngine::gui_controlsChangeSounds, -1, "Sounds are ", 34, 49, 0, 0},
+ 248, 249, 250, &KyraEngine::gui_controlsChangeSounds, -1, 0, 34, 49, 0, 0},
{1, 0, 0, 0, 110, 0, 64, 64, 15, 252, 253, 5, 0,
- 248, 249, 250, &KyraEngine::gui_controlsChangeWalk, -1, "Walk speed ", 34, 66, 0, 0},
+ 248, 249, 250, &KyraEngine::gui_controlsChangeWalk, -1, 0, 34, 66, 0, 0},
{1, 0, 0, 0, 110, 0, 81, 64, 15, 252, 253, 5, 0,
248, 249, 250, 0, -1, 0, 34, 83, 0, 0 },
{1, 0, 0, 0, 110, 0, 98, 64, 15, 252, 253, 5, 0,
- 248, 249, 250, &KyraEngine::gui_controlsChangeText, -1, "Text speed ", 34, 100, 0, 0 },
+ 248, 249, 250, &KyraEngine::gui_controlsChangeText, -1, 0, 34, 100, 0, 0 },
- {1, 0, 0, "Main Menu", 64, 0, 127, 92, 15, 252, 253, -1, 255,
+ {1, 0, 0, 0, 64, 0, 127, 92, 15, 252, 253, -1, 255,
248, 249, 250, &KyraEngine::gui_cancelSubMenu, -1, -0, 0, 0, 0, 0}
}
}