2007-05-30 21:56:52 +00:00
/* 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 .
2002-09-19 17:44:41 +00:00
*
2021-12-26 17:47:58 +00:00
* 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 3 of the License , or
* ( at your option ) any later version .
2002-09-19 17:44:41 +00:00
*
* 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
2021-12-26 17:47:58 +00:00
* along with this program . If not , see < http : //www.gnu.org/licenses/>.
2014-02-18 01:34:24 +00:00
*
2002-09-19 17:44:41 +00:00
*/
2003-11-03 23:26:13 +00:00
# include "common/config-manager.h"
2005-10-01 21:13:38 +00:00
# include "common/savefile.h"
2005-01-10 22:06:49 +00:00
# include "common/system.h"
2007-06-03 17:32:42 +00:00
# include "common/events.h"
2011-08-20 11:51:22 +00:00
# include "common/localization.h"
2010-06-15 10:47:31 +00:00
# include "common/translation.h"
2020-06-16 19:57:23 +00:00
# include "common/ustr.h"
2006-02-20 20:29:02 +00:00
# include "graphics/scaler.h"
2003-11-03 23:26:13 +00:00
2010-11-16 10:19:01 +00:00
# include "gui/gui-manager.h"
2016-04-14 10:29:08 +00:00
# include "gui/widget.h"
2008-08-08 10:37:58 +00:00
# include "gui/ThemeEval.h"
2003-11-03 23:26:13 +00:00
2003-10-03 18:33:57 +00:00
# include "scumm/dialogs.h"
# include "scumm/sound.h"
# include "scumm/scumm.h"
2006-02-20 20:57:26 +00:00
# include "scumm/imuse/imuse.h"
2003-10-03 18:33:57 +00:00
# include "scumm/verbs.h"
2002-09-19 17:44:41 +00:00
2003-06-14 21:18:14 +00:00
# ifndef DISABLE_HELP
2003-10-03 18:33:57 +00:00
# include "scumm/help.h"
2003-06-14 21:18:14 +00:00
# endif
2008-11-12 14:30:16 +00:00
using Graphics : : kTextAlignCenter ;
using Graphics : : kTextAlignLeft ;
2003-12-01 22:16:29 +00:00
using GUI : : WIDGET_ENABLED ;
2003-11-11 00:40:35 +00:00
2003-10-03 18:33:57 +00:00
namespace Scumm {
2006-10-15 01:24:17 +00:00
static const ResString string_map_table_v8 [ ] = {
2006-03-04 05:44:48 +00:00
{ 0 , " /BT_100/Please insert disk %d. Press ENTER " } ,
{ 0 , " /BT__003/Unable to Find %s, (%s %d) Press Button. " } ,
{ 0 , " /BT__004/Error reading disk %c, (%c%d) Press Button. " } ,
{ 0 , " /BT__002/Game Paused. Press SPACE to Continue. " } ,
{ 0 , " /BT__005/Are you sure you want to restart? (Y/N) " } , //BOOT.004
2022-07-05 07:41:05 +00:00
{ 0 , " /BT__006/Are you sure you want to quit? (Y/N) " } , //BOOT.005
2006-03-04 05:44:48 +00:00
{ 0 , " /BT__008/Save " } ,
{ 0 , " /BT__009/Load " } ,
{ 0 , " /BT__010/Play " } ,
{ 0 , " /BT__011/Cancel " } ,
{ 0 , " /BT__012/Quit " } ,
{ 0 , " /BT__013/OK " } ,
{ 0 , " " } ,
{ 0 , " /BT__014/You must enter a name " } ,
{ 0 , " /BT__015/The game was NOT saved (disk full?) " } ,
{ 0 , " /BT__016/The game was NOT loaded " } ,
{ 0 , " /BT__017/Saving '%s' " } ,
{ 0 , " /BT__018/Loading '%s' " } ,
{ 0 , " /BT__019/Name your SAVE game " } ,
2022-06-21 16:08:22 +00:00
{ 0 , " /BT__020/Select a game to LOAD " } ,
{ 0 , " /BT__028/Do you want to replace this saved game? (Y/N)Y " } ,
{ 0 , " /SYST200/Are you sure you want to quit? " } ,
{ 0 , " /SYST201/Yes " } ,
{ 0 , " /SYST202/No " } ,
{ 0 , " /SYST203/iMuse buffer count changed to %d " } ,
{ 0 , " /BT_104/Voice and Text " } ,
{ 0 , " /BT_105/Text Display Only " } ,
{ 0 , " /BT_103/Voice Only " } ,
{ 0 , " /SYST300/y " } ,
2022-08-22 21:44:37 +00:00
{ 0 , " /BOOT.005/Are you sure you want to quit? (Y-N)Y " } , // Demo strings
2022-07-05 07:41:05 +00:00
{ 0 , " /NEW.23/Text Speed Slow ========== Fast " } ,
{ 0 , " /NEW.24/Music Volume Low ========= High " } ,
{ 0 , " /NEW.25/Voice Volume Low ========= High " } ,
2022-08-10 14:33:09 +00:00
{ 0 , " /NEW.26/Sfx Volume Low ========= High " } ,
2022-11-01 11:46:57 +00:00
{ 0 , " Heap %dK " } , // Non-translatable string
{ 0 , " Are you sure you want to restart? (Y-N)Y " } // Not in the original
2006-03-04 05:44:48 +00:00
} ;
2006-10-15 01:24:17 +00:00
static const ResString string_map_table_v7 [ ] = {
2002-09-19 17:44:41 +00:00
{ 96 , " game name and version " } , //that's how it's supposed to be
2006-03-01 04:32:44 +00:00
{ 83 , " Unable to Find %s, (%c%d) Press Button. " } ,
{ 84 , " Error reading disk %c, (%c%d) Press Button. " } ,
2006-03-04 05:44:48 +00:00
{ 85 , " /BOOT.003/Game Paused. Press SPACE to Continue. " } ,
{ 86 , " /BOOT.004/Are you sure you want to restart? (Y/N) " } ,
{ 87 , " /BOOT.005/Are you sure you want to quit? (Y/N) " } ,
{ 70 , " /BOOT.008/Save " } ,
{ 71 , " /BOOT.009/Load " } ,
{ 72 , " /BOOT.010/Play " } ,
2007-09-19 08:40:12 +00:00
{ 73 , " /BOOT.011/Cancel " } ,
2006-03-04 05:44:48 +00:00
{ 74 , " /BOOT.012/Quit " } ,
{ 75 , " /BOOT.013/OK " } ,
2006-03-01 04:32:44 +00:00
{ 0 , " " } ,
2006-03-04 05:44:48 +00:00
{ 78 , " /BOOT.014/You must enter a name " } ,
{ 81 , " /BOOT.015/The game was NOT saved (disk full?) " } ,
{ 82 , " /BOOT.016/The game was NOT loaded " } ,
{ 79 , " /BOOT.017/Saving '%s' " } ,
{ 80 , " /BOOT.018/Loading '%s' " } ,
{ 76 , " /BOOT.019/Name your SAVE game " } ,
2022-08-10 14:33:09 +00:00
{ 77 , " /BOOT.020/Select a game to LOAD " } ,
// Original GUI strings
2006-03-04 05:44:48 +00:00
{ 68 , " /BOOT.007/c: \\ dig " } ,
{ 69 , " /BOOT.021/The Dig " } ,
{ 70 , " /BOOT.008/Save " } ,
{ 71 , " /BOOT.009/Load " } ,
{ 72 , " /BOOT.010/Play " } ,
{ 73 , " /BOOT.011/Cancel " } ,
{ 74 , " /BOOT.012/Quit " } ,
{ 75 , " /BOOT.013/OK " } ,
{ 76 , " /BOOT.019/Name your SAVE game " } ,
{ 77 , " /BOOT.020/Select a game to LOAD " } ,
{ 78 , " /BOOT.014/You must enter a name " } ,
{ 79 , " /BOOT.017/Saving '%s' " } ,
{ 80 , " /BOOT.018/Loading '%s' " } ,
{ 81 , " /BOOT.015/The game was NOT saved (disk full?) " } ,
{ 82 , " /BOOT.016/The game was NOT loaded " } ,
2006-03-01 01:17:40 +00:00
{ 83 , " Unable to Find %s, (%c%d) Press Button. " } ,
{ 84 , " Error reading disk %c, (%c%d) Press Button. " } ,
2006-03-04 05:44:48 +00:00
{ 85 , " /BOOT.003/Game Paused. Press SPACE to Continue. " } ,
{ 86 , " /BOOT.004/Are you sure you want to restart? (Y/N) " } ,
{ 87 , " /BOOT.005/Are you sure you want to quit? (Y/N) " } ,
{ 90 , " /BOOT.022/Music " } ,
{ 91 , " /BOOT.023/Voice " } ,
{ 92 , " /BOOT.024/Sfx " } ,
{ 93 , " /BOOT.025/disabled " } ,
{ 94 , " /BOOT.026/Text speed " } ,
{ 95 , " /BOOT.027/Display Text " } ,
2022-08-10 14:33:09 +00:00
{ 96 , " game name and version " } ,
2022-08-12 12:02:59 +00:00
{ 137 , " /BOOT.028/Spooled Music " } ,
{ 138 , " /BOOT.029/Do you want to replace this saved game? (Y/N) " } ,
2022-08-10 14:33:09 +00:00
{ 141 , " /NEW.020/Voice Only " } ,
{ 142 , " /NEW.021/Voice and Text " } ,
{ 143 , " /NEW.022/Text Display Only " } ,
{ 145 , " /NEW.023/Text Speed Slow ========== Fast " } ,
{ 147 , " /NEW.024/Music Volume Low ========= High " } ,
{ 149 , " /NEW.025/Voice Volume Low ========= High " } ,
{ 151 , " /NEW.026/SFX Volume Low ========= High " } ,
{ 144 , " Heap %dK " } ,
{ 0 , " iMuse buffer count changed to %d " } // Not in the original
2002-09-19 17:44:41 +00:00
} ;
2006-10-15 01:24:17 +00:00
static const ResString string_map_table_v6 [ ] = {
2006-03-01 04:32:44 +00:00
{ 90 , " Insert Disk %c and Press Button to Continue. " } ,
{ 91 , " Unable to Find %s, (%c%d) Press Button. " } ,
{ 92 , " Error reading disk %c, (%c%d) Press Button. " } ,
{ 93 , " Game Paused. Press SPACE to Continue. " } ,
2016-05-24 08:11:33 +00:00
{ 94 , " Are you sure you want to restart? (Y/N)Y " } ,
{ 95 , " Are you sure you want to quit? (Y/N)Y " } ,
2005-07-30 21:11:48 +00:00
{ 96 , " Save " } ,
{ 97 , " Load " } ,
{ 98 , " Play " } ,
{ 99 , " Cancel " } ,
{ 100 , " Quit " } ,
{ 101 , " OK " } ,
2006-03-01 04:32:44 +00:00
{ 102 , " Insert save/load game disk " } ,
{ 103 , " You must enter a name " } ,
{ 104 , " The game was NOT saved (disk full?) " } ,
{ 105 , " The game was NOT loaded " } ,
{ 106 , " Saving '%s' " } ,
{ 107 , " Loading '%s' " } ,
{ 108 , " Name your SAVE game " } ,
{ 109 , " Select a game to LOAD " } ,
2022-08-15 20:58:42 +00:00
{ 117 , " How may I serve you? " } ,
2022-12-05 10:49:51 +00:00
{ 80 , " Text Speed " } , // see also fixedDottMenuStrings[]
2022-08-15 20:58:42 +00:00
{ 81 , " Display Text " } ,
{ 113 , " Music " } ,
{ 114 , " Voice " } ,
{ 115 , " Sfx " } ,
{ 116 , " disabled " } ,
{ 0 , " Voice Only " } ,
{ 0 , " Voice and Text " } ,
{ 0 , " Text Display Only " } ,
{ 0 , " Text Speed Slow ========== Fast " } ,
{ 0 , " Music Volume Low ========= High " } ,
{ 0 , " Voice Volume Low ========= High " } ,
{ 0 , " SFX Volume Low ========= High " } ,
2022-12-20 21:38:26 +00:00
{ 0 , " Heap %dK " } ,
{ 0 , " Recalibrating Joystick " } ,
{ 0 , " Joystick Mode " } , // SAMNMAX Floppy
{ 0 , " Mouse Mode " }
2002-09-19 17:44:41 +00:00
} ;
# pragma mark -
2010-04-06 09:26:04 +00:00
# ifndef DISABLE_HELP
class HelpDialog : public ScummDialog {
public :
HelpDialog ( const GameSettings & game ) ;
2020-02-09 11:05:32 +00:00
void handleCommand ( GUI : : CommandSender * sender , uint32 cmd , uint32 data ) override ;
2010-04-06 09:26:04 +00:00
2020-02-09 11:05:32 +00:00
void reflowLayout ( ) override ;
2010-04-06 09:26:04 +00:00
protected :
typedef Common : : String String ;
GUI : : ButtonWidget * _nextButton ;
GUI : : ButtonWidget * _prevButton ;
GUI : : StaticTextWidget * _title ;
GUI : : StaticTextWidget * _key [ HELP_NUM_LINES ] ;
GUI : : StaticTextWidget * _dsc [ HELP_NUM_LINES ] ;
int _page ;
int _numPages ;
int _numLines ;
const GameSettings _game ;
void displayKeyBindings ( ) ;
} ;
# endif
# pragma mark -
2010-01-05 22:18:09 +00:00
ScummDialog : : ScummDialog ( int x , int y , int w , int h ) : GUI : : Dialog ( x , y , w , h ) {
_backgroundType = GUI : : ThemeEngine : : kDialogBackgroundSpecial ;
}
2008-08-13 17:46:00 +00:00
ScummDialog : : ScummDialog ( String name ) : GUI : : Dialog ( name ) {
2008-11-10 11:24:55 +00:00
_backgroundType = GUI : : ThemeEngine : : kDialogBackgroundSpecial ;
2006-01-28 23:03:39 +00:00
}
2002-09-19 17:44:41 +00:00
# pragma mark -
2003-06-14 21:18:14 +00:00
# ifndef DISABLE_HELP
2005-05-14 22:47:00 +00:00
2010-05-26 19:54:50 +00:00
ScummMenuDialog : : ScummMenuDialog ( ScummEngine * scumm )
: MainMenuDialog ( scumm ) {
2006-04-29 23:23:32 +00:00
_helpDialog = new HelpDialog ( scumm - > _game ) ;
2010-05-26 19:54:50 +00:00
_helpButton - > setEnabled ( true ) ;
2003-06-14 21:18:14 +00:00
}
2008-07-07 06:05:48 +00:00
ScummMenuDialog : : ~ ScummMenuDialog ( ) {
2003-06-14 21:18:14 +00:00
delete _helpDialog ;
2009-07-22 19:25:53 +00:00
}
2010-11-01 16:00:17 +00:00
void ScummMenuDialog : : handleCommand ( GUI : : CommandSender * sender , uint32 cmd , uint32 data ) {
2002-09-19 17:44:41 +00:00
switch ( cmd ) {
2003-06-14 21:18:14 +00:00
case kHelpCmd :
_helpDialog - > runModal ( ) ;
break ;
2002-09-19 17:44:41 +00:00
default :
2010-05-26 19:54:50 +00:00
MainMenuDialog : : handleCommand ( sender , cmd , data ) ;
2002-10-19 01:22:41 +00:00
}
}
2003-06-14 21:18:14 +00:00
# pragma mark -
enum {
kNextCmd = ' NEXT ' ,
kPrevCmd = ' PREV '
} ;
2006-04-29 23:23:32 +00:00
HelpDialog : : HelpDialog ( const GameSettings & game )
2008-08-10 18:26:14 +00:00
: ScummDialog ( " ScummHelp " ) , _game ( game ) {
2020-11-15 18:15:58 +00:00
_title = new GUI : : StaticTextWidget ( this , " ScummHelp.Title " , Common : : U32String ( ) ) ;
2006-05-18 16:44:44 +00:00
_page = 1 ;
2008-11-10 11:24:55 +00:00
_backgroundType = GUI : : ThemeEngine : : kDialogBackgroundDefault ;
2006-05-18 16:44:44 +00:00
_numPages = ScummHelp : : numPages ( _game . id ) ;
2011-08-20 14:11:47 +00:00
// I18N: Previous page button
2020-11-15 18:15:58 +00:00
_prevButton = new GUI : : ButtonWidget ( this , " ScummHelp.Prev " , _ ( " ~P~revious " ) , Common : : U32String ( ) , kPrevCmd ) ;
2011-08-20 14:11:47 +00:00
// I18N: Next page button
2020-11-15 18:15:58 +00:00
_nextButton = new GUI : : ButtonWidget ( this , " ScummHelp.Next " , _ ( " ~N~ext " ) , Common : : U32String ( ) , kNextCmd ) ;
new GUI : : ButtonWidget ( this , " ScummHelp.Close " , _ ( " ~C~lose " ) , Common : : U32String ( ) , GUI : : kCloseCmd ) ;
2006-05-18 16:44:44 +00:00
_prevButton - > clearFlags ( WIDGET_ENABLED ) ;
2019-12-28 09:43:58 +00:00
GUI : : ContainerWidget * placeHolder = new GUI : : ContainerWidget ( this , " ScummHelp.HelpText " ) ;
placeHolder - > setBackgroundType ( GUI : : ThemeEngine : : kWidgetBackgroundNo ) ;
2009-07-16 17:44:05 +00:00
_numLines = HELP_NUM_LINES ;
2009-07-16 17:29:31 +00:00
2006-05-18 16:44:44 +00:00
// Dummy entries
for ( int i = 0 ; i < HELP_NUM_LINES ; i + + ) {
2020-11-15 18:15:58 +00:00
_key [ i ] = new GUI : : StaticTextWidget ( this , 0 , 0 , 10 , 10 , Common : : U32String ( ) , Graphics : : kTextAlignRight ) ;
_dsc [ i ] = new GUI : : StaticTextWidget ( this , 0 , 0 , 10 , 10 , Common : : U32String ( ) , Graphics : : kTextAlignLeft ) ;
2006-05-18 16:44:44 +00:00
}
}
2006-08-04 13:55:53 +00:00
void HelpDialog : : reflowLayout ( ) {
ScummDialog : : reflowLayout ( ) ;
2006-05-18 16:44:44 +00:00
2005-06-03 12:51:37 +00:00
int lineHeight = g_gui . getFontHeight ( ) ;
2008-08-10 18:26:14 +00:00
int16 x , y ;
2020-05-09 19:04:53 +00:00
int16 w , h ;
2009-01-01 15:06:43 +00:00
2015-11-27 23:03:49 +00:00
assert ( lineHeight ) ;
2020-06-06 10:35:37 +00:00
g_gui . xmlEval ( ) - > getWidgetData ( " ScummHelp.HelpText " , x , y , w , h ) ;
2009-01-01 15:06:43 +00:00
2009-07-16 17:39:16 +00:00
// Make sure than we don't have more lines than what we can fit
// on the space that the layout reserves for text
2009-07-16 17:44:05 +00:00
_numLines = MIN ( HELP_NUM_LINES , ( int ) ( h / lineHeight ) ) ;
2009-07-16 17:29:31 +00:00
2008-08-10 18:26:14 +00:00
int keyW = w * 20 / 100 ;
2008-08-15 16:44:44 +00:00
int dscX = x + keyW + 32 ;
2008-08-10 18:26:14 +00:00
int dscW = w * 80 / 100 ;
2009-01-01 15:06:43 +00:00
2008-08-15 16:44:44 +00:00
int xoff = ( _w > > 1 ) - ( w > > 1 ) ;
2003-06-14 21:18:14 +00:00
2009-07-16 17:29:31 +00:00
for ( int i = 0 ; i < _numLines ; i + + ) {
2021-03-31 22:48:39 +00:00
_key [ i ] - > resize ( xoff + x , y + lineHeight * i , keyW , lineHeight , false ) ;
_dsc [ i ] - > resize ( xoff + dscX , y + lineHeight * i , dscW , lineHeight , false ) ;
2003-06-14 21:18:14 +00:00
}
displayKeyBindings ( ) ;
}
void HelpDialog : : displayKeyBindings ( ) {
2020-07-01 23:23:38 +00:00
U32String titleStr , * keyStr , * dscStr ;
2003-06-14 21:18:14 +00:00
2006-04-29 23:23:32 +00:00
ScummHelp : : updateStrings ( _game . id , _game . version , _game . platform , _page , titleStr , keyStr , dscStr ) ;
2003-06-14 21:18:14 +00:00
_title - > setLabel ( titleStr ) ;
2009-07-16 17:39:16 +00:00
for ( int i = 0 ; i < _numLines ; i + + ) {
2003-06-14 21:18:14 +00:00
_key [ i ] - > setLabel ( keyStr [ i ] ) ;
_dsc [ i ] - > setLabel ( dscStr [ i ] ) ;
}
2008-05-07 14:31:45 +00:00
delete [ ] keyStr ;
delete [ ] dscStr ;
2003-06-14 21:18:14 +00:00
}
2010-11-01 16:00:17 +00:00
void HelpDialog : : handleCommand ( GUI : : CommandSender * sender , uint32 cmd , uint32 data ) {
2003-07-15 00:20:04 +00:00
2003-06-14 21:18:14 +00:00
switch ( cmd ) {
case kNextCmd :
_page + + ;
if ( _page > = _numPages ) {
_nextButton - > clearFlags ( WIDGET_ENABLED ) ;
}
if ( _page > = 2 ) {
_prevButton - > setFlags ( WIDGET_ENABLED ) ;
}
displayKeyBindings ( ) ;
2018-01-06 15:13:29 +00:00
g_gui . scheduleTopDialogRedraw ( ) ;
2003-06-14 21:18:14 +00:00
break ;
case kPrevCmd :
_page - - ;
if ( _page < = _numPages ) {
_nextButton - > setFlags ( WIDGET_ENABLED ) ;
}
if ( _page < = 1 ) {
_prevButton - > clearFlags ( WIDGET_ENABLED ) ;
}
displayKeyBindings ( ) ;
2018-01-06 15:13:29 +00:00
g_gui . scheduleTopDialogRedraw ( ) ;
2003-06-14 21:18:14 +00:00
break ;
default :
ScummDialog : : handleCommand ( sender , cmd , data ) ;
}
}
# endif
2002-10-27 12:26:41 +00:00
# pragma mark -
2021-07-16 12:23:20 +00:00
static bool isCJKLanguage ( Common : : Language lang ) {
switch ( lang ) {
case Common : : KO_KOR :
case Common : : JA_JPN :
case Common : : ZH_TWN :
2021-11-04 20:49:21 +00:00
case Common : : ZH_CHN :
2021-07-16 12:23:20 +00:00
return true ;
default :
return false ;
}
}
2003-11-02 02:18:16 +00:00
InfoDialog : : InfoDialog ( ScummEngine * scumm , int res )
2020-10-24 23:38:05 +00:00
: ScummDialog ( 0 , 0 , 0 , 0 ) , _vm ( scumm ) , _style ( GUI : : ThemeEngine : : kFontStyleBold ) { // dummy x and w
2007-06-02 12:01:09 +00:00
_message = queryResString ( res ) ;
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
// Trim the hardcoded strings for the GUI Dialog. The extra spaces which some strings have might
2022-08-17 23:29:27 +00:00
// be needed for proper alignment within the original display, but not here...
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
if ( scumm - > _game . version < 3 )
_message . trim ( ) ;
2021-07-16 12:23:20 +00:00
Common : : Language lang = isCJKLanguage ( _vm - > _language ) ? _vm - > _language : Common : : UNK_LANG ;
2020-10-24 23:38:05 +00:00
2007-06-02 12:01:09 +00:00
// Width and height are dummy
2020-10-24 23:38:05 +00:00
_text = new GUI : : StaticTextWidget ( this , 0 , 0 , 10 , 10 , _message , kTextAlignCenter , Common : : U32String ( ) , GUI : : ThemeEngine : : kFontStyleBold , lang ) ;
// Store this for the calls to getStringWidth() and getStringHeight() in reflowLayout().
if ( lang ! = Common : : UNK_LANG )
_style = GUI : : ThemeEngine : : kFontStyleLangExtra ;
2002-10-27 12:26:41 +00:00
}
2020-06-29 22:10:13 +00:00
InfoDialog : : InfoDialog ( ScummEngine * scumm , const U32String & message )
2020-10-24 23:38:05 +00:00
: ScummDialog ( 0 , 0 , 0 , 0 ) , _vm ( scumm ) , _style ( GUI : : ThemeEngine : : kFontStyleBold ) { // dummy x and w
2002-10-27 12:26:41 +00:00
2006-05-18 16:44:44 +00:00
_message = message ;
2006-05-18 19:37:38 +00:00
// Width and height are dummy
2010-11-01 16:00:17 +00:00
_text = new GUI : : StaticTextWidget ( this , 0 , 0 , 10 , 10 , _message , kTextAlignCenter ) ;
2006-05-18 16:44:44 +00:00
}
2020-06-29 22:10:13 +00:00
void InfoDialog : : setInfoText ( const U32String & message ) {
2007-06-02 12:01:09 +00:00
_message = message ;
_text - > setLabel ( _message ) ;
//reflowLayout(); // FIXME: Should we call this here? Depends on the usage patterns, I guess...
}
2006-08-04 13:55:53 +00:00
void InfoDialog : : reflowLayout ( ) {
2005-05-16 12:26:44 +00:00
const int screenW = g_system - > getOverlayWidth ( ) ;
const int screenH = g_system - > getOverlayHeight ( ) ;
2020-10-24 23:38:05 +00:00
int width = g_gui . getStringWidth ( _message , _style ) + 16 ;
int height = g_gui . getFontHeight ( _style ) + 8 ;
2003-03-06 17:58:13 +00:00
2002-10-27 12:26:41 +00:00
_w = width ;
2005-05-16 12:26:44 +00:00
_h = height ;
_x = ( screenW - width ) / 2 ;
_y = ( screenH - height ) / 2 ;
2002-10-27 12:26:41 +00:00
2009-08-16 11:28:59 +00:00
_text - > setSize ( _w , _h ) ;
2002-10-27 12:26:41 +00:00
}
2022-10-03 20:52:00 +00:00
const char * InfoDialog : : getPlainEngineString ( int stringno , bool forceHardcodedString ) {
const char * result = nullptr ;
2022-08-10 14:33:09 +00:00
2022-06-21 16:08:22 +00:00
if ( stringno = = 0 )
return nullptr ;
2022-08-10 14:33:09 +00:00
if ( _vm - > _game . version = = 8 ) {
2022-08-23 16:36:55 +00:00
return string_map_table_v8 [ stringno - 1 ] . string ;
2022-08-10 14:33:09 +00:00
} else if ( _vm - > _game . version = = 7 ) {
2022-08-23 16:36:55 +00:00
result = ( const char * ) _vm - > getStringAddressVar ( string_map_table_v7 [ stringno - 1 ] . num ) ;
2022-08-10 14:33:09 +00:00
if ( ! result ) {
2022-08-23 16:36:55 +00:00
result = string_map_table_v7 [ stringno - 1 ] . string ;
2022-08-10 14:33:09 +00:00
}
} else if ( _vm - > _game . version = = 6 ) {
2022-08-23 16:36:55 +00:00
result = ( const char * ) _vm - > getStringAddressVar ( string_map_table_v6 [ stringno - 1 ] . num ) ;
2022-08-15 20:58:42 +00:00
if ( ! result ) {
2022-12-05 10:49:51 +00:00
if ( stringno > = 22 & & stringno < = 27 & & _vm - > _game . id = = GID_TENTACLE & & _vm - > _enableEnhancements & & strcmp ( _vm - > _game . variant , " Floppy " ) ) {
result = getStaticResString ( _vm - > _language , stringno - 1 ) . string ;
} else {
result = string_map_table_v6 [ stringno - 1 ] . string ;
}
2022-08-15 20:58:42 +00:00
}
2022-08-10 14:33:09 +00:00
} else if ( _vm - > _game . version > = 3 ) {
2022-12-09 20:06:14 +00:00
if ( _vm - > _game . platform = = Common : : kPlatformSegaCD )
result = ( const char * ) _vm - > getStringAddress ( stringno ) ;
else if ( ! forceHardcodedString )
2022-10-03 20:52:00 +00:00
result = ( const char * ) _vm - > getStringAddress ( getStaticResString ( _vm - > _language , stringno - 1 ) . num ) ;
2022-08-17 23:29:27 +00:00
if ( ! result ) {
2022-08-23 16:36:55 +00:00
result = getStaticResString ( _vm - > _language , stringno - 1 ) . string ;
2022-08-17 23:29:27 +00:00
}
2022-08-10 14:33:09 +00:00
} else {
2022-08-23 16:36:55 +00:00
result = getStaticResString ( _vm - > _language , stringno - 1 ) . string ;
2022-08-10 14:33:09 +00:00
}
return result ;
2022-06-21 16:08:22 +00:00
}
2022-08-19 11:17:48 +00:00
void decodeV2String ( Common : : Language lang , Common : : String & str ) {
struct mapping { char o , n ; } ;
// Just the bare minimum needed for the strings in getStaticResString()...
static const mapping mapFR [ ] = { { ' [ ' , ' \x82 ' } , { ' < ' , ' \x85 ' } , { ' ~ ' , ' \x96 ' } , { ' \0 ' , ' \0 ' } } ;
2022-08-22 15:51:24 +00:00
static const mapping mapDE [ ] = { { ' [ ' , ' \x81 ' } , { ' \\ ' , ' \x84 ' } , { ' \0 ' , ' \0 ' } } ;
2022-08-19 11:17:48 +00:00
static const mapping mapIT [ ] = { { ' \0 ' , ' \0 ' } } ;
static const mapping mapES [ ] = { { ' \0 ' , ' \0 ' } } ;
static const mapping mapRU [ ] = { { ' \0 ' , ' \0 ' } } ;
static const mapping mapSE [ ] = { { ' \0 ' , ' \0 ' } } ;
const mapping * map = 0 ;
switch ( lang ) {
case Common : : FR_FRA :
map = mapFR ;
break ;
case Common : : DE_DEU :
map = mapDE ;
break ;
case Common : : IT_ITA :
map = mapIT ;
break ;
case Common : : ES_ESP :
map = mapES ;
break ;
case Common : : RU_RUS :
map = mapRU ;
break ;
case Common : : SE_SWE :
map = mapSE ;
break ;
default :
break ;
}
if ( map ) {
while ( map - > o ) {
for ( uint16 i = 0 ; i < str . size ( ) ; + + i ) {
if ( str [ i ] = = map - > o )
str . setChar ( map - > n , i ) ;
}
+ + map ;
}
}
}
2020-08-29 09:29:58 +00:00
const Common : : U32String InfoDialog : : queryResString ( int stringno ) {
2006-04-29 23:23:32 +00:00
byte buf [ 256 ] ;
2021-07-16 12:23:00 +00:00
byte reverseBuf [ 256 ] ;
2006-10-24 09:44:20 +00:00
const byte * result ;
2006-04-29 23:23:32 +00:00
if ( stringno = = 0 )
return String ( ) ;
2014-08-19 22:36:40 +00:00
if ( _vm - > _game . heversion > = 80 )
return _ ( string_map_table_v6 [ stringno - 1 ] . string ) ;
else if ( _vm - > _game . version = = 8 )
2006-10-24 09:44:20 +00:00
result = ( const byte * ) string_map_table_v8 [ stringno - 1 ] . string ;
2006-04-29 23:23:32 +00:00
else if ( _vm - > _game . version = = 7 )
result = _vm - > getStringAddressVar ( string_map_table_v7 [ stringno - 1 ] . num ) ;
else if ( _vm - > _game . version = = 6 )
result = _vm - > getStringAddressVar ( string_map_table_v6 [ stringno - 1 ] . num ) ;
else if ( _vm - > _game . version > = 3 )
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
result = _vm - > getStringAddress ( getStaticResString ( _vm - > _language , stringno - 1 ) . num ) ;
2006-04-29 23:23:32 +00:00
else
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
result = ( const byte * ) getStaticResString ( _vm - > _language , stringno - 1 ) . string ;
2006-04-29 23:23:32 +00:00
if ( result & & * result = = ' / ' ) {
2022-08-19 13:11:52 +00:00
_vm - > translateText ( result , buf , sizeof ( buf ) ) ;
2006-04-29 23:23:32 +00:00
result = buf ;
}
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
if ( ! result | | * result = = ' \0 ' ) // Gracelessly degrade to english :)
result = ( const byte * ) getStaticResString ( _vm - > _language , stringno - 1 ) . string ;
2006-04-29 23:23:32 +00:00
2022-08-19 13:11:52 +00:00
if ( _vm - > reverseIfNeeded ( result , reverseBuf , sizeof ( reverseBuf ) ) )
2021-07-16 12:23:00 +00:00
result = reverseBuf ;
2006-04-29 23:23:32 +00:00
// Convert to a proper string (take care of FF codes)
byte chr ;
String tmp ;
while ( ( chr = * result + + ) ) {
if ( chr = = 0xFF ) {
result + = 3 ;
} else if ( chr ! = ' @ ' ) {
tmp + = chr ;
}
}
2020-09-12 23:39:41 +00:00
2022-08-19 11:17:48 +00:00
// The localized v1/v2 games use custom encodings, different for each language.
// We just remap the characters that we need here..
if ( _vm - > _game . version < 3 )
decodeV2String ( _vm - > _language , tmp ) ;
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
return U32String ( tmp , _vm - > getDialogCodePage ( ) ) ;
}
const ResString & InfoDialog : : getStaticResString ( Common : : Language lang , int stringno ) {
// The string parts are only needed for v1/2. So we need to provide only the
// language varieties that exist for these. I have added the langugage I found
// in scumm-md5.h. I guess we could actually ditch the first 3 lines...
static const ResString strMap1 [ ] [ 6 ] = {
{ // English
{ 1 , " Insert Disk %c and Press Button to Continue. " } , // Original DOS has: "Please Insert Disk n. Press ENTER"
{ 2 , " Unable to Find %s, (%c%d) Press Button. " } , // Original DOS has: "Unable to find file nn.lfl Press ENTER"
{ 3 , " Error reading disk %c, (%c%d) Press Button. " } , // Original DOS has: "ERROR READING FILE. HIT KEY TO RETRY'" and "ERROR READING %d type %d"
{ 4 , " Game paused, press SPACE to continue. " } , // Original string from the English v1/v2 interpreters
{ 5 , " Are you sure you want to restart? (y/n)y " } , // Original string from the English v1/v2 interpreters
2022-08-19 11:17:48 +00:00
{ 6 , " Are you sure you want to quit? (y/n)y " } // The original does not have a quit confirmation question. So this it just the restart string with a word replacement.
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
} ,
{ // French
2022-08-19 11:17:48 +00:00
{ 1 , " Ins[rez le disque n. Appuyez sur ENTER. " } , // Original DOS
{ 2 , " Incapable de trouver la fiche nn.lfl. Appuyez sur ENTER. " } , // Original DOS (bad translation...)
{ 3 , " ERREUR. Appuyez sur une touche pour essayer < nouveau. " } , // Original DOS (with that many spaces, maybe to force it to go to a new line?)
{ 4 , " PAUSE-Appuyez sur SPACE pour continuer. " } , // Original string
{ 5 , " Etes-vous s~r de vouloir recommencer? (o/n)o " } , // Original string: note the lack of the ending letter after the last parenthesis. Multiple spaces make the "(o/n)" part go to the next line
{ 6 , " Etes-vous s~r de vouloir quitter ? (o/n)o " } // (matching the previous sentence)
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
} ,
{ // German
2022-08-22 15:51:24 +00:00
{ 1 , " Diskette n einlegen. Bet \\ tige EINGABE. " } , // Original DOS German v2
{ 2 , " Datei nn.lfl nicht gefunden. EINGABE. " } , // Original DOS German v2
{ 3 , " ERROR. Bet \\ tigen Sie eine Taste. " } , // Original DOS German v2
{ 4 , " PAUSE - Zum Spielen Leertaste dr[cken. " } , // Original DOS German v2
{ 5 , " Wollen Sie neu starten? (j/n)j " } , // Original DOS German v2
{ 6 , " Wollen Sie wirklich beenden? (j/n)j " } // (matching the previous sentence)
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
} ,
{ // Italian
2022-10-03 20:52:00 +00:00
{ 1 , " Inserisci il Disk n. Premi ENTER. " } , // Original DOS Italian v2
{ 2 , " Non trovato il file nn.lfl. Premi ENTER. " } , // Original DOS Italian v2
{ 3 , " ERROR READING %d type %d " } , // As found on the Italian v2 executable...
{ 4 , " PAUSA - Premere SPAZIO per continuare. " } , // Original DOS Italian v2
{ 5 , " Sei sicuro di voler ricominciare? (s/n)s " } , // Original DOS Italian v2
2022-10-11 13:09:07 +00:00
{ 6 , " Sei sicuro di voler uscire? (s/n)s " } // (matching the previous sentence)
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
} ,
{ // Spanish
{ 1 , " Introduce el disco %c y pulsa un bot " " \xa2 " " n para continuar. " } ,
{ 2 , " No se ha podido encontrar %s, (%c%d). Pulsa un bot " " \xa2 " " n. " } ,
{ 3 , " Error al leer el disco %c, (%c%d). Pulsa un bot " " \xa2 " " n. " } ,
{ 4 , " Partida en pausa. Pulsa Espacio para continuar. " } ,
{ 5 , " " " \xa8 " " Seguro que quieres reiniciar? (S/N)S " } ,
{ 6 , " " " \xa8 " " Seguro que quieres salir? (S/N)S " }
} ,
{ // Russian
{ 1 , " \x82 \xe1 \xe2 \xa0 \xa2 \xec \xe2 \xa5 " " " " \xa4 \xa8 \xe1 \xaa " " %c " " \xa8 " " " " \xad \xa0 \xa6 \xac \xa8 \xe2 \xa5 " " " " \xaa \xab \xa0 \xa2 \xa8 \xe8 \xe3 " " , " " \xe7 \xe2 \xae \xa1 \xeb " " " " \xaf \xe0 \xae \xa4 \xae \xab \xa6 \xa8 \xe2 \xec " " . " } ,
{ 2 , " \x8d \xa5 " " " " \xe3 \xa4 \xa0 \xab \xae \xe1 \xec " " " " \xad \xa0 \xa9 \xe2 \xa8 " " %s, (%c%d) " " \x8d \xa0 \xa6 \xac \xa8 \xe2 \xa5 " " " " \xaa \xab \xa0 \xa2 \xa8 \xe8 \xe3 " " . " } ,
{ 3 , " \x8e \xe8 \xa8 \xa1 \xaa \xa0 " " " " \xe7 \xe2 \xa5 \xad \xa8 \xef " " " " \xa4 \xa8 \xe1 \xaa \xa0 " " %c, (%c%d) " " \x8d \xa0 \xa6 \xac \xa8 \xe2 \xa5 " " " " \xaa \xab \xa0 \xa2 \xa8 \xe8 \xe3 " " . " } ,
{ 4 , " \x88 \xa3 \xe0 \xa0 " " " " \xaf \xe0 \xa8 \xae \xe1 \xe2 \xa0 \xad \xae \xa2 \xab \xa5 \xad \xa0 " " . " " \x84 \xab \xef " " " " \xaf \xe0 \xae \xa4 \xae \xab \xa6 \xa5 \xad \xa8 \xef " " " " \xad \xa0 \xa6 \xac \xa8 \xe2 \xa5 " " " " \xaf \xe0 \xae \xa1 \xa5 \xab " " . " } ,
{ 5 , " \x82 \xeb " " " " \xe3 \xa2 \xa5 \xe0 \xa5 \xad \xeb " " , " " \xe7 \xe2 \xae " " " " \xe5 \xae \xe2 \xa8 \xe2 \xa5 " " " " \xad \xa0 \xe7 \xa0 \xe2 \xec " " " " \xe1 \xad \xae \xa2 \xa0 " " ? (Y/N)Y " } ,
{ 6 , " \x82 \xeb " " " " \xe3 \xa2 \xa5 \xe0 \xa5 \xad \xeb " " , " " \xe7 \xe2 \xae " " " " \xe5 \xae \xe2 \xa8 \xe2 \xa5 " " " " \xa2 \xeb \xa9 \xe2 \xa8 " " ? (Y/N)Y " }
} ,
{ // Swedish (seems to concern MM NES only)
{ 1 , " Mata in skivan %c och tryck p " " \x86 " " knappen f " " \x94 " " r att forts " " \x84 " " tta. " } ,
{ 2 , " Kunde inte hitta %s, (%c%d) tryck p " " \x86 " " knappen. " } ,
{ 3 , " Fel vid inl " " \x84 " " sning av skivan %c, (%c%d) tryck p " " \x86 " " knappen. " } ,
{ 4 , " Spelet pausat. Tryck MELLANSLAG f " " \x94 " " r att forts " " \x84 " " tta. " } ,
{ 5 , " " " \x8e " " r du s " " \x84 " " ker p " " \x86 " " att du vill starta om? (J/N)J " } ,
{ 6 , " " " \x8e " " r du s " " \x84 " " ker p " " \x86 " " att du vill avsluta? (J/N)J " }
}
} ;
2022-08-17 23:29:27 +00:00
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
// Added in SCUMM4. Only the numbers are used, so there
2022-08-17 23:29:27 +00:00
// is no need to provide language specific strings; there are
// some exceptions for which there's only an hardcoded English
// string.
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
static const ResString strMap2 [ ] = {
{ 7 , ( " Save " ) } ,
{ 8 , ( " Load " ) } ,
{ 9 , ( " Play " ) } ,
{ 10 , ( " Cancel " ) } ,
{ 11 , ( " Quit " ) } ,
{ 12 , ( " OK " ) } ,
{ 13 , ( " Insert save/load game disk " ) } ,
{ 14 , ( " You must enter a name " ) } ,
{ 15 , ( " The game was NOT saved (disk full?) " ) } ,
{ 16 , ( " The game was NOT loaded " ) } ,
{ 17 , ( " Saving '%s' " ) } ,
{ 18 , ( " Loading '%s' " ) } ,
{ 19 , ( " Name your SAVE game " ) } ,
{ 20 , ( " Select a game to LOAD " ) } ,
2022-08-17 23:29:27 +00:00
{ 28 , ( " Game title) " ) } ,
// Hardcoded in English for each localized version
{ 0 , " Voice Only " } ,
{ 0 , " Voice and Text " } ,
{ 0 , " Text Display Only " } ,
{ 0 , " Text Speed Slow ========== Fast " } ,
{ 0 , " Roland Volume Low ========= High " } ,
2022-10-11 13:09:07 +00:00
{ 0 , " Heap %dK " } ,
// Snap scroll messages
{ 0 , " Snap Scroll On " } , // v2
{ 0 , " Snap Scroll Off " } ,
{ 0 , " Screen reposition instantly " } , // v3
{ 0 , " Screen reposition by Scrolling " } ,
{ 0 , " Horizontal Screen Snap " } , // v4
{ 0 , " Horizontal Screen Scroll " } ,
// Miscellaneous input messages
{ 0 , " Recalibrating Joystick " } ,
{ 0 , " Mouse Mode " } ,
{ 0 , " Mouse On " } ,
{ 0 , " Mouse Off " } ,
{ 0 , " Joystick On " } ,
{ 0 , " Joystick Off " } ,
{ 0 , " Sounds On " } ,
{ 0 , " Sounds Off " } ,
// V1-2 graphic modes
{ 0 , " VGA Graphics " } ,
{ 0 , " EGA Graphics " } ,
{ 0 , " CGA Graphics " } ,
{ 0 , " Hercules Graphics " } ,
{ 0 , " TANDY Graphics " }
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
} ;
2022-11-01 22:21:38 +00:00
// V3 games (except LOOM) do not have a quit prompt message set in the scripts:
// we use this table to hardcode one for each language...
static const ResString hardcodedV3QuitPrompt [ ] = {
{ 0 , " Are you sure you want to quit? (Y/N)Y " } , // EN
{ 0 , " Etes vous s \x96 r de vouloir quitter (O/N)O " } , // FR
{ 0 , " Wollen Sie wirklich aufh \x94 ren? (J/N)J " } , // DE
{ 0 , " Sei sicuro di voler uscire? (S/N)S " } , // IT
{ 0 , " " " \xc2 \xa8 " " Est " " \xc2 \xa0 " " s seguro de querer abandonar? (S/N)S " } , // ES
{ 0 , " (Y/N)Y " } , // RU - Placeholder: I don't know of any RU version of v3 games
{ 0 , " (Y/N)Y " } , // SE - Placeholder: I don't know of any SE version of v3 games
{ 0 , " \x96 { \x93 \x96 \x82 \xC9 \x8F I \x97 \xB9 \x82 \xB5 \x82 \xC4 \x82 \xE0 \x82 \xA2 \x82 \xA2 \x82 \xC5 \x82 \xB7 \x82 \xA9 \x81 H (Y/N)Y " } // JA
} ;
2022-12-05 10:49:51 +00:00
// DOTT (CD) doesn't have translations for some menu options, but this was
// fixed in Sam & Max (CD) which uses the same menu, so we just borrow its
// official translations (from script 1-1) for better language accessibility.
static const ResString fixedDottMenuStrings [ ] [ 6 ] = {
{
// English
{ 0 , " Text Speed " } ,
{ 0 , " Display Text " } ,
{ 0 , " Music " } ,
{ 0 , " Voice " } ,
{ 0 , " Sfx " } ,
{ 0 , " disabled " } ,
} ,
{
// French
{ 0 , " Vitesse Txt " } ,
{ 0 , " Affich. texte " } ,
{ 0 , " Musique " } ,
{ 0 , " Voix " } ,
{ 0 , " Effets son. " } ,
{ 0 , " off " }
} ,
{
// German
{ 0 , " Textflu \xE1 " } ,
{ 0 , " Textanzeige " } ,
{ 0 , " Musik " } ,
{ 0 , " Sprache " } ,
{ 0 , " Sfx " } ,
{ 0 , " ausgeschaltet " }
} ,
{
// Italian
{ 0 , " Velocit \x85 " } ,
{ 0 , " MostraTesto " } ,
{ 0 , " Musica " } ,
{ 0 , " Voce " } ,
{ 0 , " Sonoro " } ,
{ 0 , " disabil. " }
} ,
{
// Spanish
{ 0 , " Veloc. Texto " } ,
{ 0 , " Ver Texto " } ,
{ 0 , " M \xA3 sica " } ,
{ 0 , " Voz " } ,
{ 0 , " Sfx " } ,
{ 0 , " inv \xA0 lido " }
}
} ;
2022-11-01 22:21:38 +00:00
bool useHardcodedV3QuitPrompt = stringno = = 5 & & _vm - > _game . version = = 3 & & _vm - > _game . id ! = GID_LOOM ;
2022-12-05 10:49:51 +00:00
bool useFixedDottMenuStrings = stringno > = 21 & & stringno < = 26 & & _vm - > _game . id = = GID_TENTACLE ;
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
// I have added the langugages I found in scumm-md5.h for v1/2 games...
int langIndex = 0 ;
switch ( lang ) {
case Common : : FR_FRA :
langIndex = 1 ;
break ;
case Common : : DE_DEU :
langIndex = 2 ;
break ;
case Common : : IT_ITA :
langIndex = 3 ;
break ;
case Common : : ES_ESP :
langIndex = 4 ;
break ;
case Common : : RU_RUS :
2022-12-05 10:49:51 +00:00
langIndex = useFixedDottMenuStrings ? 0 : 5 ;
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
break ;
case Common : : SE_SWE :
2022-12-05 10:49:51 +00:00
langIndex = useFixedDottMenuStrings ? 0 : 6 ;
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
break ;
2022-11-01 22:21:38 +00:00
case Common : : JA_JPN :
langIndex = useHardcodedV3QuitPrompt ? 7 : 0 ;
break ;
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
default :
// Just stick with English.
break ;
}
2022-11-01 22:21:38 +00:00
if ( useHardcodedV3QuitPrompt ) {
return hardcodedV3QuitPrompt [ langIndex ] ;
}
2022-12-05 10:49:51 +00:00
if ( useFixedDottMenuStrings ) {
stringno - = 21 ;
return fixedDottMenuStrings [ langIndex ] [ stringno ] ;
}
2022-11-01 22:21:38 +00:00
if ( stringno + 1 > = ARRAYSIZE ( strMap1 ) ) {
stringno - = ARRAYSIZE ( strMap1 ) - 1 ;
assert ( stringno < ARRAYSIZE ( strMap2 ) ) ;
return strMap2 [ stringno ] ;
}
2022-10-11 13:09:07 +00:00
// Special case for ZAK v2 ITA, which has a different string both for the pause
// message and for the restart message.
// If it can be verified that other languages have different strings for this game
// we can refactor strMap1 to contain both a MM string and a ZAK string; but with
// currently only one language doing this, it seems overkill...
if ( _vm - > _game . version = = 2 & & _vm - > _game . id = = GID_ZAK & & langIndex = = 3 ) {
if ( stringno = = 3 ) {
static const ResString altStr = { 4 , " PAUSE - Premere SPACE per continuare. " } ;
return altStr ;
} else if ( stringno = = 4 ) {
static const ResString altStr = { 5 , " Sei sicuro che vuoi ricominciare? (s/n)s " } ;
return altStr ;
}
}
SCUMM: (v1-3) - improve pause/restart/quit string handling
The recent PR 4204 made me aware of some things I had kind of tried to ignore when I updated these dialogs for CJK font support.
Currently, the language for the pause/restart/quit messages is tied to the GUI/launcher language and the translation manager is used to translate the. E. g., if you start the French version of MM or ZAK and have a launcher language setting of English, you will get the English pause/restart/quit messages. If you set the launcher language to French you will get it the French ones. Also, the encodings from the translation manager aren't compatible with the game string encodings (mostly solved by PR 4204, though).
This commit now gets rid of any translation manager use here. Instead, we tie the translations for these messages to the game language.
I have included all strings for the v1/v2 language variants I found in the detection table.
I am interested in having the exact original messages here. However, I have only inserted them from the English interpreters, since those are all I have. For the other languages, for the time being, I have just used the texts from the translation manager and reencoded those with codepage 850. So, if anyone has access to an original v1/v2 interpreter in French, Italian, German, Spanish, Russian or Swedish, he/she might want to extract and replace the strings here with the correct ones...
2022-08-17 23:46:16 +00:00
return strMap1 [ langIndex ] [ stringno ] ;
2006-04-29 23:23:32 +00:00
}
2002-10-27 12:26:41 +00:00
# pragma mark -
2004-07-20 11:30:15 +00:00
PauseDialog : : PauseDialog ( ScummEngine * scumm , int res )
: InfoDialog ( scumm , res ) {
2002-12-14 10:46:00 +00:00
}
2002-10-27 12:26:41 +00:00
2007-06-30 12:26:59 +00:00
void PauseDialog : : handleKeyDown ( Common : : KeyState state ) {
if ( state . ascii = = ' ' ) // Close pause dialog if space key is pressed
2003-07-28 01:36:16 +00:00
close ( ) ;
2003-12-14 20:36:37 +00:00
else
2007-06-30 12:26:59 +00:00
ScummDialog : : handleKeyDown ( state ) ;
2003-07-28 01:36:16 +00:00
}
2006-03-01 04:32:44 +00:00
ConfirmDialog : : ConfirmDialog ( ScummEngine * scumm , int res )
2010-09-13 23:35:55 +00:00
: InfoDialog ( scumm , res ) , _yesKey ( ' y ' ) , _noKey ( ' n ' ) {
2020-06-29 22:10:13 +00:00
if ( _message . empty ( ) )
return ;
if ( _message [ _message . size ( ) - 1 ] ! = ' ) ' ) {
_yesKey = _message [ _message . size ( ) - 1 ] ;
2010-09-13 23:35:55 +00:00
_message . deleteLastChar ( ) ;
if ( _yesKey > = ' A ' & & _yesKey < = ' Z ' )
_yesKey + = ' a ' - ' A ' ;
_text - > setLabel ( _message ) ;
reflowLayout ( ) ;
}
2003-12-14 15:04:05 +00:00
}
2007-06-30 12:26:59 +00:00
void ConfirmDialog : : handleKeyDown ( Common : : KeyState state ) {
2011-08-20 11:51:22 +00:00
Common : : KeyCode keyYes , keyNo ;
2011-08-20 17:36:54 +00:00
Common : : getLanguageYesNo ( keyYes , keyNo ) ;
2011-08-20 11:51:22 +00:00
if ( state . keycode = = Common : : KEYCODE_n | | state . ascii = = _noKey | | state . ascii = = keyNo ) {
2003-12-14 15:04:05 +00:00
setResult ( 0 ) ;
close ( ) ;
2011-08-20 11:51:22 +00:00
} else if ( state . keycode = = Common : : KEYCODE_y | | state . ascii = = _yesKey | | state . ascii = = keyYes ) {
2003-12-14 15:04:05 +00:00
setResult ( 1 ) ;
close ( ) ;
} else
2007-06-30 12:26:59 +00:00
ScummDialog : : handleKeyDown ( state ) ;
2003-12-14 15:04:05 +00:00
}
2005-03-06 18:00:54 +00:00
# pragma mark -
2020-07-20 22:54:04 +00:00
ValueDisplayDialog : : ValueDisplayDialog ( const Common : : U32String & label , int minVal , int maxVal ,
2006-08-04 17:59:53 +00:00
int val , uint16 incKey , uint16 decKey )
2010-01-05 22:18:09 +00:00
: GUI : : Dialog ( 0 , 0 , 0 , 0 ) ,
2006-08-04 17:59:53 +00:00
_label ( label ) , _min ( minVal ) , _max ( maxVal ) ,
2016-11-26 19:48:22 +00:00
_value ( val ) , _incKey ( incKey ) , _decKey ( decKey ) , _timer ( 0 ) {
2005-03-06 18:00:54 +00:00
assert ( _min < = _value & & _value < = _max ) ;
2006-08-04 15:48:37 +00:00
}
2018-01-07 09:39:22 +00:00
void ValueDisplayDialog : : drawDialog ( GUI : : DrawLayer layerToDraw ) {
Dialog : : drawDialog ( layerToDraw ) ;
2006-08-04 15:48:37 +00:00
const int labelWidth = _w - 8 - _percentBarWidth ;
2006-08-04 17:59:53 +00:00
g_gui . theme ( ) - > drawText ( Common : : Rect ( _x + 4 , _y + 4 , _x + labelWidth + 4 ,
_y + g_gui . theme ( ) - > getFontHeight ( ) + 4 ) , _label ) ;
g_gui . theme ( ) - > drawSlider ( Common : : Rect ( _x + 4 + labelWidth , _y + 4 , _x + _w - 4 , _y + _h - 4 ) ,
_percentBarWidth * ( _value - _min ) / ( _max - _min ) ) ;
2006-08-04 15:48:37 +00:00
}
void ValueDisplayDialog : : handleTickle ( ) {
2010-03-11 23:41:28 +00:00
if ( g_system - > getMillis ( ) > _timer ) {
2006-08-04 15:48:37 +00:00
close ( ) ;
}
}
void ValueDisplayDialog : : reflowLayout ( ) {
2005-05-27 13:14:39 +00:00
const int screenW = g_system - > getOverlayWidth ( ) ;
const int screenH = g_system - > getOverlayHeight ( ) ;
2008-11-12 13:14:44 +00:00
_percentBarWidth = screenW * 100 / 640 ;
2005-05-27 13:14:39 +00:00
2006-08-04 15:48:37 +00:00
int width = g_gui . getStringWidth ( _label ) + 16 + _percentBarWidth ;
2005-06-03 12:51:37 +00:00
int height = g_gui . getFontHeight ( ) + 4 * 2 ;
2005-03-06 18:00:54 +00:00
2005-05-27 13:14:39 +00:00
_x = ( screenW - width ) / 2 ;
_y = ( screenH - height ) / 2 ;
2005-03-06 18:00:54 +00:00
_w = width ;
2005-05-27 13:14:39 +00:00
_h = height ;
2005-03-06 18:00:54 +00:00
}
2007-06-30 12:26:59 +00:00
void ValueDisplayDialog : : handleKeyDown ( Common : : KeyState state ) {
if ( state . ascii = = _incKey | | state . ascii = = _decKey ) {
if ( state . ascii = = _incKey & & _value < _max )
2005-03-06 18:00:54 +00:00
_value + + ;
2007-06-30 12:26:59 +00:00
else if ( state . ascii = = _decKey & & _value > _min )
2005-03-06 18:00:54 +00:00
_value - - ;
2005-07-30 21:11:48 +00:00
2005-03-06 18:00:54 +00:00
setResult ( _value ) ;
2010-03-11 23:41:28 +00:00
_timer = g_system - > getMillis ( ) + kDisplayDelay ;
2018-01-06 15:13:29 +00:00
g_gui . scheduleTopDialogRedraw ( ) ;
2005-03-06 18:00:54 +00:00
} else {
close ( ) ;
}
}
2005-03-08 23:44:07 +00:00
void ValueDisplayDialog : : open ( ) {
2010-04-06 09:25:44 +00:00
GUI : : Dialog : : open ( ) ;
2005-03-08 23:44:07 +00:00
setResult ( _value ) ;
2010-03-11 23:41:28 +00:00
_timer = g_system - > getMillis ( ) + kDisplayDelay ;
2005-03-08 23:44:07 +00:00
}
2007-09-19 08:40:12 +00:00
SubtitleSettingsDialog : : SubtitleSettingsDialog ( ScummEngine * scumm , int value )
2020-11-15 18:15:58 +00:00
: InfoDialog ( scumm , U32String ( ) ) , _value ( value ) , _timer ( 0 ) {
2007-06-03 17:32:42 +00:00
}
void SubtitleSettingsDialog : : handleTickle ( ) {
InfoDialog : : handleTickle ( ) ;
2010-03-11 23:41:28 +00:00
if ( g_system - > getMillis ( ) > _timer )
2007-06-03 17:32:42 +00:00
close ( ) ;
}
2007-06-30 12:26:59 +00:00
void SubtitleSettingsDialog : : handleKeyDown ( Common : : KeyState state ) {
2010-02-21 04:04:13 +00:00
if ( state . keycode = = Common : : KEYCODE_t & & state . hasFlags ( Common : : KBD_CTRL ) ) {
2007-06-03 17:32:42 +00:00
cycleValue ( ) ;
reflowLayout ( ) ;
2018-01-06 15:13:29 +00:00
g_gui . scheduleTopDialogRedraw ( ) ;
2007-06-03 17:32:42 +00:00
} else {
close ( ) ;
}
}
void SubtitleSettingsDialog : : open ( ) {
cycleValue ( ) ;
InfoDialog : : open ( ) ;
2008-04-30 12:53:05 +00:00
setResult ( _value ) ;
2007-06-03 17:32:42 +00:00
}
void SubtitleSettingsDialog : : cycleValue ( ) {
2011-09-08 18:13:13 +00:00
static const char * const subtitleDesc [ ] = {
2011-08-20 09:34:12 +00:00
_s ( " Speech Only " ) ,
_s ( " Speech and Subtitles " ) ,
_s ( " Subtitles Only " )
2007-06-03 17:32:42 +00:00
} ;
2007-09-19 08:40:12 +00:00
2008-04-30 12:53:05 +00:00
_value + = 1 ;
if ( _value > 2 )
_value = 0 ;
2007-06-03 17:32:42 +00:00
2008-08-15 19:10:37 +00:00
if ( _value = = 1 & & g_system - > getOverlayWidth ( ) < = 320 )
2020-08-20 06:15:58 +00:00
setInfoText ( _c ( " Speech & Subs " , " lowres " ) ) ;
2008-08-15 19:10:37 +00:00
else
2011-08-20 09:34:12 +00:00
setInfoText ( _ ( subtitleDesc [ _value ] ) ) ;
2007-06-03 17:32:42 +00:00
2010-03-11 23:41:28 +00:00
_timer = g_system - > getMillis ( ) + 1500 ;
2007-06-03 17:32:42 +00:00
}
2007-05-30 16:40:11 +00:00
Indy3IQPointsDialog : : Indy3IQPointsDialog ( ScummEngine * scumm , char * text )
2020-07-03 21:43:05 +00:00
: InfoDialog ( scumm , Common : : U32String ( text ) ) {
2007-05-30 16:40:11 +00:00
}
2005-03-06 18:00:54 +00:00
2007-06-30 12:26:59 +00:00
void Indy3IQPointsDialog : : handleKeyDown ( Common : : KeyState state ) {
2007-09-19 08:40:12 +00:00
if ( state . ascii = = ' i ' )
2007-05-30 16:40:11 +00:00
close ( ) ;
else
2007-06-30 12:26:59 +00:00
ScummDialog : : handleKeyDown ( state ) ;
2007-05-30 16:40:11 +00:00
}
2005-03-06 18:00:54 +00:00
2007-09-20 20:50:38 +00:00
DebugInputDialog : : DebugInputDialog ( ScummEngine * scumm , char * text )
2020-06-16 19:57:23 +00:00
: InfoDialog ( scumm , U32String ( text ) ) {
2007-09-20 20:50:38 +00:00
mainText = text ;
done = 0 ;
}
void DebugInputDialog : : handleKeyDown ( Common : : KeyState state ) {
if ( state . keycode = = Common : : KEYCODE_BACKSPACE & & buffer . size ( ) > 0 ) {
buffer . deleteLastChar ( ) ;
Common : : String total = mainText + ' ' + buffer ;
setInfoText ( total ) ;
2018-01-06 15:13:29 +00:00
g_gui . scheduleTopDialogRedraw ( ) ;
2007-09-20 20:50:38 +00:00
reflowLayout ( ) ;
} else if ( state . keycode = = Common : : KEYCODE_RETURN ) {
done = 1 ;
close ( ) ;
return ;
} else if ( ( state . ascii > = ' 0 ' & & state . ascii < = ' 9 ' ) | | ( state . ascii > = ' A ' & & state . ascii < = ' Z ' ) | | ( state . ascii > = ' a ' & & state . ascii < = ' z ' ) | | state . ascii = = ' . ' | | state . ascii = = ' ' ) {
buffer + = state . ascii ;
Common : : String total = mainText + ' ' + buffer ;
2018-01-06 15:13:29 +00:00
g_gui . scheduleTopDialogRedraw ( ) ;
2007-09-20 20:50:38 +00:00
reflowLayout ( ) ;
setInfoText ( total ) ;
2008-01-27 19:47:41 +00:00
}
2007-09-20 20:50:38 +00:00
}
2011-12-24 20:09:46 +00:00
LoomTownsDifficultyDialog : : LoomTownsDifficultyDialog ( )
2021-04-15 19:20:04 +00:00
: Dialog ( " LoomTownsDifficultyDialog " ) , _difficulty ( - 1 ) {
2011-12-24 20:09:46 +00:00
GUI : : StaticTextWidget * text1 = new GUI : : StaticTextWidget ( this , " LoomTownsDifficultyDialog.Description1 " , _ ( " Select a Proficiency Level. " ) ) ;
text1 - > setAlign ( Graphics : : kTextAlignCenter ) ;
GUI : : StaticTextWidget * text2 = new GUI : : StaticTextWidget ( this , " LoomTownsDifficultyDialog.Description2 " , _ ( " Refer to your Loom(TM) manual for help. " ) ) ;
text2 - > setAlign ( Graphics : : kTextAlignCenter ) ;
2020-11-15 18:15:58 +00:00
new GUI : : ButtonWidget ( this , " LoomTownsDifficultyDialog.Standard " , _ ( " Standard " ) , Common : : U32String ( ) , kStandardCmd ) ;
new GUI : : ButtonWidget ( this , " LoomTownsDifficultyDialog.Practice " , _ ( " Practice " ) , Common : : U32String ( ) , kPracticeCmd ) ;
new GUI : : ButtonWidget ( this , " LoomTownsDifficultyDialog.Expert " , _ ( " Expert " ) , Common : : U32String ( ) , kExpertCmd ) ;
2011-12-24 20:09:46 +00:00
}
void LoomTownsDifficultyDialog : : handleCommand ( GUI : : CommandSender * sender , uint32 cmd , uint32 data ) {
switch ( cmd ) {
case kStandardCmd :
_difficulty = 1 ;
close ( ) ;
break ;
case kPracticeCmd :
_difficulty = 0 ;
close ( ) ;
break ;
case kExpertCmd :
_difficulty = 2 ;
close ( ) ;
break ;
default :
GUI : : Dialog : : handleCommand ( sender , cmd , data ) ;
}
}
2022-05-28 12:14:22 +00:00
// Game options widgets
// Normally this would be added as a static game settings widget, but I see no
// way to get both the dynamic and the static one, so we have to duplicate it
// here.
GUI : : CheckboxWidget * ScummOptionsContainerWidget : : createEnhancementsCheckbox ( GuiObject * boss , const Common : : String & name ) {
return new GUI : : CheckboxWidget ( boss , name , _ ( " Enable game-specific enhancements " ) , _ ( " Allow ScummVM to make small enhancements to the game, usually based on other versions of the same game. " ) ) ;
}
2022-11-11 09:38:23 +00:00
GUI : : CheckboxWidget * ScummOptionsContainerWidget : : createOriginalGUICheckbox ( GuiObject * boss , const Common : : String & name ) {
2023-01-19 12:01:45 +00:00
return new GUI : : CheckboxWidget ( boss , name ,
_ ( " Enable the original GUI and Menu " ) ,
_ ( " Allow the game to use the in-engine graphical interface and the original save/load menu. Use it together with the \" Ask for confirmation on exit \" for a more complete experience. " )
) ;
2022-11-11 09:38:23 +00:00
}
2022-05-28 12:14:22 +00:00
void ScummOptionsContainerWidget : : updateAdjustmentSlider ( GUI : : SliderWidget * slider , GUI : : StaticTextWidget * value ) {
int adjustment = slider - > getValue ( ) ;
const char * sign = " " ;
if ( adjustment < 0 ) {
adjustment = - adjustment ;
sign = " - " ;
} else if ( adjustment > 0 )
sign = " + " ;
value - > setLabel ( Common : : String : : format ( " %s%d.%02d " , sign , adjustment / 100 , adjustment % 100 ) ) ;
}
// EGA Loom Overture settings
2022-03-09 07:53:14 +00:00
LoomEgaGameOptionsWidget : : LoomEgaGameOptionsWidget ( GuiObject * boss , const Common : : String & name , const Common : : String & domain ) :
2022-05-28 12:14:22 +00:00
ScummOptionsContainerWidget ( boss , name , " LoomEgaGameOptionsDialog " , domain ) {
2022-03-09 07:53:14 +00:00
GUI : : StaticTextWidget * text = new GUI : : StaticTextWidget ( widgetsBoss ( ) , " LoomEgaGameOptionsDialog.OvertureTicksLabel " , _ ( " Overture Timing: " ) ) ;
2022-02-03 15:36:00 +00:00
2022-02-12 11:02:55 +00:00
text - > setAlign ( Graphics : : TextAlign : : kTextAlignEnd ) ;
2022-02-03 15:36:00 +00:00
2022-03-09 07:53:14 +00:00
_overtureTicksSlider = new GUI : : SliderWidget ( widgetsBoss ( ) , " LoomEgaGameOptionsDialog.OvertureTicks " , _ ( " When using replacement music, this adjusts the time when the Overture changes to the scene with the Lucasfilm and Loom logotypes. " ) , kOvertureTicksChanged ) ;
2022-02-12 11:02:55 +00:00
2022-03-01 13:53:06 +00:00
// In the Ozawa recording, the transition happens at about 1:56. At is
// turns out, this is a fairly fast version of the tune. After checking
// a number of different recordings, I've settled on an interval of
// 1:40 - 2:50. This is larger than I had hoped, but I guess it's
// really necessary.
//
// Hopefully that still means you can set the slider back to its default
// value at most reasonable screen resolutions.
_overtureTicksSlider - > setMinValue ( - 160 ) ;
_overtureTicksSlider - > setMaxValue ( 540 ) ;
2022-02-03 15:36:00 +00:00
2022-03-09 07:53:14 +00:00
_overtureTicksValue = new GUI : : StaticTextWidget ( widgetsBoss ( ) , " LoomEgaGameOptionsDialog.OvertureTicksValue " , Common : : U32String ( ) ) ;
2022-02-03 15:36:00 +00:00
2022-03-09 07:35:22 +00:00
_overtureTicksValue - > setFlags ( GUI : : WIDGET_CLEARBG ) ;
2022-03-23 15:02:49 +00:00
2022-05-28 12:14:22 +00:00
_enableEnhancementsCheckbox = createEnhancementsCheckbox ( widgetsBoss ( ) , " LoomEgaGameOptionsDialog.EnableEnhancements " ) ;
2022-11-11 09:38:23 +00:00
_enableOriginalGUICheckbox = createOriginalGUICheckbox ( widgetsBoss ( ) , " LoomEgaGameOptionsDialog.EnableOriginalGUI " ) ;
2022-02-03 15:36:00 +00:00
}
2022-03-09 07:53:14 +00:00
void LoomEgaGameOptionsWidget : : load ( ) {
2022-02-03 18:40:22 +00:00
int loomOvertureTicks = 0 ;
2022-02-03 15:36:00 +00:00
if ( ConfMan . hasKey ( " loom_overture_ticks " , _domain ) )
loomOvertureTicks = ConfMan . getInt ( " loom_overture_ticks " , _domain ) ;
_overtureTicksSlider - > setValue ( loomOvertureTicks ) ;
2022-03-09 07:35:22 +00:00
updateOvertureTicksValue ( ) ;
2022-03-23 15:02:49 +00:00
2022-05-28 12:14:22 +00:00
_enableEnhancementsCheckbox - > setState ( ConfMan . getBool ( " enable_enhancements " , _domain ) ) ;
2022-11-11 09:38:23 +00:00
_enableOriginalGUICheckbox - > setState ( ConfMan . getBool ( " original_gui " , _domain ) ) ;
2022-02-03 15:36:00 +00:00
}
2022-03-09 07:53:14 +00:00
bool LoomEgaGameOptionsWidget : : save ( ) {
2022-02-03 15:36:00 +00:00
ConfMan . setInt ( " loom_overture_ticks " , _overtureTicksSlider - > getValue ( ) , _domain ) ;
2022-05-28 12:14:22 +00:00
ConfMan . setBool ( " enable_enhancements " , _enableEnhancementsCheckbox - > getState ( ) , _domain ) ;
2022-11-11 09:38:23 +00:00
ConfMan . setBool ( " original_gui " , _enableOriginalGUICheckbox - > getState ( ) , _domain ) ;
2022-02-03 15:36:00 +00:00
return true ;
}
2022-03-09 07:53:14 +00:00
void LoomEgaGameOptionsWidget : : defineLayout ( GUI : : ThemeEval & layouts , const Common : : String & layoutName , const Common : : String & overlayedLayout ) const {
2022-02-03 15:36:00 +00:00
layouts . addDialog ( layoutName , overlayedLayout )
2022-11-11 09:38:23 +00:00
. addLayout ( GUI : : ThemeLayout : : kLayoutVertical , 5 )
2022-03-23 15:02:49 +00:00
. addPadding ( 0 , 0 , 0 , 0 )
2022-11-11 09:38:23 +00:00
. addLayout ( GUI : : ThemeLayout : : kLayoutVertical , 4 )
. addPadding ( 0 , 0 , 10 , 0 )
. addWidget ( " EnableOriginalGUI " , " Checkbox " )
. addWidget ( " EnableEnhancements " , " Checkbox " )
. closeLayout ( )
2022-03-23 15:02:49 +00:00
. addLayout ( GUI : : ThemeLayout : : kLayoutHorizontal , 12 )
2022-11-11 09:38:23 +00:00
. addPadding ( 0 , 0 , 10 , 0 )
2022-03-23 15:02:49 +00:00
. addWidget ( " OvertureTicksLabel " , " OptionsLabel " )
. addWidget ( " OvertureTicks " , " WideSlider " )
. addWidget ( " OvertureTicksValue " , " ShortOptionsLabel " )
. closeLayout ( )
2022-02-03 15:36:00 +00:00
. closeLayout ( )
. closeDialog ( ) ;
}
2022-03-09 07:53:14 +00:00
void LoomEgaGameOptionsWidget : : handleCommand ( GUI : : CommandSender * sender , uint32 cmd , uint32 data ) {
2022-02-03 15:36:00 +00:00
switch ( cmd ) {
case kOvertureTicksChanged :
2022-03-09 07:35:22 +00:00
updateOvertureTicksValue ( ) ;
2022-02-03 15:36:00 +00:00
break ;
default :
GUI : : OptionsContainerWidget : : handleCommand ( sender , cmd , data ) ;
break ;
}
}
2022-03-09 07:53:14 +00:00
void LoomEgaGameOptionsWidget : : updateOvertureTicksValue ( ) {
2022-02-12 11:02:55 +00:00
int ticks = DEFAULT_LOOM_OVERTURE_TRANSITION + _overtureTicksSlider - > getValue ( ) ;
2022-03-09 07:35:22 +00:00
_overtureTicksValue - > setLabel ( Common : : String : : format ( " %d:%02d.%d " , ticks / 600 , ( ticks % 600 ) / 10 , ticks % 10 ) ) ;
2022-02-03 15:36:00 +00:00
}
2022-05-28 12:14:22 +00:00
// VGA Loom Playback Adjustment settings
LoomVgaGameOptionsWidget : : LoomVgaGameOptionsWidget ( GuiObject * boss , const Common : : String & name , const Common : : String & domain ) :
ScummOptionsContainerWidget ( boss , name , " LoomVgaGameOptionsDialog " , domain ) {
GUI : : StaticTextWidget * text = new GUI : : StaticTextWidget ( widgetsBoss ( ) , " LoomVgaGameOptionsDialog.PlaybackAdjustmentLabel " , _ ( " Playback Adjust: " ) ) ;
text - > setAlign ( Graphics : : TextAlign : : kTextAlignEnd ) ;
_playbackAdjustmentSlider = new GUI : : SliderWidget ( widgetsBoss ( ) , " LoomVgaGameOptionsDialog.PlaybackAdjustment " , _ ( " When playing sound from the CD audio track, adjust the start position of the sound by this much. Use this if you often hear bits of the wrong sound. " ) , kPlaybackAdjustmentChanged ) ;
// The first sound in the track is played from frame 22. It's not
// possible to move that more than about 0.3 seconds towards zero.
// Everything else can be moved by as much as two seconds in each
// direction.
_playbackAdjustmentSlider - > setMinValue ( - 200 ) ;
_playbackAdjustmentSlider - > setMaxValue ( 200 ) ;
_playbackAdjustmentValue = new GUI : : StaticTextWidget ( widgetsBoss ( ) , " LoomVgaGameOptionsDialog.PlaybackAdjustmentValue " , Common : : U32String ( ) ) ;
_playbackAdjustmentValue - > setFlags ( GUI : : WIDGET_CLEARBG ) ;
_enableEnhancementsCheckbox = createEnhancementsCheckbox ( widgetsBoss ( ) , " LoomVgaGameOptionsDialog.EnableEnhancements " ) ;
2022-11-11 09:38:23 +00:00
_enableOriginalGUICheckbox = createOriginalGUICheckbox ( widgetsBoss ( ) , " LoomVgaGameOptionsDialog.EnableOriginalGUI " ) ;
2022-05-28 12:14:22 +00:00
}
void LoomVgaGameOptionsWidget : : load ( ) {
int playbackAdjustment = 0 ;
if ( ConfMan . hasKey ( " loom_playback_adjustment " , _domain ) )
playbackAdjustment = ConfMan . getInt ( " loom_playback_adjustment " , _domain ) ;
_playbackAdjustmentSlider - > setValue ( playbackAdjustment ) ;
updatePlaybackAdjustmentValue ( ) ;
_enableEnhancementsCheckbox - > setState ( ConfMan . getBool ( " enable_enhancements " , _domain ) ) ;
2022-11-11 09:38:23 +00:00
_enableOriginalGUICheckbox - > setState ( ConfMan . getBool ( " original_gui " , _domain ) ) ;
2022-05-28 12:14:22 +00:00
}
bool LoomVgaGameOptionsWidget : : save ( ) {
ConfMan . setInt ( " loom_playback_adjustment " , _playbackAdjustmentSlider - > getValue ( ) , _domain ) ;
ConfMan . setBool ( " enable_enhancements " , _enableEnhancementsCheckbox - > getState ( ) , _domain ) ;
2022-11-11 09:38:23 +00:00
ConfMan . setBool ( " original_gui " , _enableOriginalGUICheckbox - > getState ( ) , _domain ) ;
2022-05-28 12:14:22 +00:00
return true ;
}
void LoomVgaGameOptionsWidget : : defineLayout ( GUI : : ThemeEval & layouts , const Common : : String & layoutName , const Common : : String & overlayedLayout ) const {
layouts . addDialog ( layoutName , overlayedLayout )
2022-11-11 09:38:23 +00:00
. addLayout ( GUI : : ThemeLayout : : kLayoutVertical , 5 )
2022-05-28 12:14:22 +00:00
. addPadding ( 0 , 0 , 0 , 0 )
2022-11-11 09:38:23 +00:00
. addLayout ( GUI : : ThemeLayout : : kLayoutVertical , 4 )
. addPadding ( 0 , 0 , 10 , 0 )
. addWidget ( " EnableOriginalGUI " , " Checkbox " )
. addWidget ( " EnableEnhancements " , " Checkbox " )
. closeLayout ( )
2022-05-28 12:14:22 +00:00
. addLayout ( GUI : : ThemeLayout : : kLayoutHorizontal , 12 )
2022-11-11 09:38:23 +00:00
. addPadding ( 0 , 0 , 10 , 0 )
2022-05-28 12:14:22 +00:00
. addWidget ( " PlaybackAdjustmentLabel " , " OptionsLabel " )
. addWidget ( " PlaybackAdjustment " , " WideSlider " )
. addWidget ( " PlaybackAdjustmentValue " , " ShortOptionsLabel " )
. closeLayout ( )
. closeLayout ( )
. closeDialog ( ) ;
}
void LoomVgaGameOptionsWidget : : handleCommand ( GUI : : CommandSender * sender , uint32 cmd , uint32 data ) {
switch ( cmd ) {
case kPlaybackAdjustmentChanged :
updatePlaybackAdjustmentValue ( ) ;
break ;
default :
GUI : : OptionsContainerWidget : : handleCommand ( sender , cmd , data ) ;
break ;
}
}
void LoomVgaGameOptionsWidget : : updatePlaybackAdjustmentValue ( ) {
updateAdjustmentSlider ( _playbackAdjustmentSlider , _playbackAdjustmentValue ) ;
}
// MI1 (CD) Playback Adjustment settings
MI1CdGameOptionsWidget : : MI1CdGameOptionsWidget ( GuiObject * boss , const Common : : String & name , const Common : : String & domain ) :
ScummOptionsContainerWidget ( boss , name , " MI1CdGameOptionsDialog " , domain ) {
Common : : String extra = ConfMan . get ( " extra " , domain ) ;
GUI : : StaticTextWidget * text = new GUI : : StaticTextWidget ( widgetsBoss ( ) , " MI1CdGameOptionsDialog.IntroAdjustmentLabel " , _ ( " Intro Adjust: " ) ) ;
text - > setAlign ( Graphics : : TextAlign : : kTextAlignEnd ) ;
_introAdjustmentSlider = new GUI : : SliderWidget ( widgetsBoss ( ) , " MI1CdGameOptionsDialog.IntroAdjustment " , _ ( " When playing the intro track, play from this point in it. Use this if the music gets cut off prematurely, or if you are unhappy with the way the music syncs up with the intro. " ) , kIntroAdjustmentChanged ) ;
_introAdjustmentSlider - > setMinValue ( 0 ) ;
_introAdjustmentSlider - > setMaxValue ( 200 ) ;
_introAdjustmentValue = new GUI : : StaticTextWidget ( widgetsBoss ( ) , " MI1CdGameOptionsDialog.IntroAdjustmentValue " , Common : : U32String ( ) ) ;
_introAdjustmentValue - > setFlags ( GUI : : WIDGET_CLEARBG ) ;
2022-05-29 07:11:52 +00:00
text = new GUI : : StaticTextWidget ( widgetsBoss ( ) , " MI1CdGameOptionsDialog.OutlookAdjustmentLabel " , _ ( " Outlook Adjust: " ) ) ;
2022-05-28 12:14:22 +00:00
2022-05-29 07:11:52 +00:00
text - > setAlign ( Graphics : : TextAlign : : kTextAlignEnd ) ;
2022-05-28 12:14:22 +00:00
2022-05-29 07:11:52 +00:00
_outlookAdjustmentSlider = new GUI : : SliderWidget ( widgetsBoss ( ) , " MI1CdGameOptionsDialog.OutlookAdjustment " , _ ( " The outlook music is part of the intro track. Adjust the position in the track at which it starts playing. Use this if the music is cut off, or if you hear part of the previous music. " ) , kOutlookAdjustmentChanged ) ;
2022-05-28 12:14:22 +00:00
2022-05-29 07:11:52 +00:00
_outlookAdjustmentSlider - > setMinValue ( - 200 ) ;
_outlookAdjustmentSlider - > setMaxValue ( 200 ) ;
2022-05-28 12:14:22 +00:00
2022-05-29 07:11:52 +00:00
_outlookAdjustmentValue = new GUI : : StaticTextWidget ( widgetsBoss ( ) , " MI1CdGameOptionsDialog.OutlookAdjustmentValue " , Common : : U32String ( ) ) ;
2022-05-28 12:14:22 +00:00
2022-05-29 07:11:52 +00:00
_outlookAdjustmentValue - > setFlags ( GUI : : WIDGET_CLEARBG ) ;
2022-05-28 12:14:22 +00:00
2022-05-29 07:11:52 +00:00
_enableEnhancementsCheckbox = createEnhancementsCheckbox ( widgetsBoss ( ) , " MI1CdGameOptionsDialog.EnableEnhancements " ) ;
2022-11-11 09:38:23 +00:00
_enableOriginalGUICheckbox = createOriginalGUICheckbox ( widgetsBoss ( ) , " MI1CdGameOptionsDialog.EnableOriginalGUI " ) ;
2022-05-28 12:14:22 +00:00
}
void MI1CdGameOptionsWidget : : load ( ) {
int introAdjustment = 0 ;
int outlookAdjustment = 0 ;
if ( ConfMan . hasKey ( " mi1_intro_adjustment " , _domain ) )
introAdjustment = ConfMan . getInt ( " mi1_intro_adjustment " , _domain ) ;
_introAdjustmentSlider - > setValue ( introAdjustment ) ;
updateIntroAdjustmentValue ( ) ;
2022-05-29 07:11:52 +00:00
if ( ConfMan . hasKey ( " mi1_outlook_adjustment " , _domain ) )
outlookAdjustment = ConfMan . getInt ( " mi1_outlook_adjustment " , _domain ) ;
2022-05-28 12:14:22 +00:00
2022-05-29 07:11:52 +00:00
_outlookAdjustmentSlider - > setValue ( outlookAdjustment ) ;
updateOutlookAdjustmentValue ( ) ;
2022-05-28 12:14:22 +00:00
2022-05-29 07:11:52 +00:00
_enableEnhancementsCheckbox - > setState ( ConfMan . getBool ( " enable_enhancements " , _domain ) ) ;
2022-11-11 09:38:23 +00:00
_enableOriginalGUICheckbox - > setState ( ConfMan . getBool ( " original_gui " , _domain ) ) ;
2022-05-28 12:14:22 +00:00
}
bool MI1CdGameOptionsWidget : : save ( ) {
ConfMan . setInt ( " mi1_intro_adjustment " , _introAdjustmentSlider - > getValue ( ) , _domain ) ;
2022-05-29 07:11:52 +00:00
ConfMan . setInt ( " mi1_outlook_adjustment " , _outlookAdjustmentSlider - > getValue ( ) , _domain ) ;
ConfMan . setBool ( " enable_enhancements " , _enableEnhancementsCheckbox - > getState ( ) , _domain ) ;
2022-11-11 09:38:23 +00:00
ConfMan . setBool ( " original_gui " , _enableOriginalGUICheckbox - > getState ( ) , _domain ) ;
2022-05-28 12:14:22 +00:00
return true ;
}
void MI1CdGameOptionsWidget : : defineLayout ( GUI : : ThemeEval & layouts , const Common : : String & layoutName , const Common : : String & overlayedLayout ) const {
layouts . addDialog ( layoutName , overlayedLayout )
2022-11-11 09:38:23 +00:00
. addLayout ( GUI : : ThemeLayout : : kLayoutVertical , 5 )
2022-05-28 12:14:22 +00:00
. addPadding ( 0 , 0 , 0 , 0 )
2022-11-11 09:38:23 +00:00
. addLayout ( GUI : : ThemeLayout : : kLayoutVertical , 4 )
. addPadding ( 0 , 0 , 10 , 0 )
. addWidget ( " EnableOriginalGUI " , " Checkbox " )
. addWidget ( " EnableEnhancements " , " Checkbox " )
. closeLayout ( )
2022-05-28 12:14:22 +00:00
. addLayout ( GUI : : ThemeLayout : : kLayoutHorizontal , 12 )
. addPadding ( 0 , 0 , 12 , 0 )
. addWidget ( " IntroAdjustmentLabel " , " OptionsLabel " )
. addWidget ( " IntroAdjustment " , " WideSlider " )
. addWidget ( " IntroAdjustmentValue " , " ShortOptionsLabel " )
2022-05-29 07:11:52 +00:00
. closeLayout ( )
. addLayout ( GUI : : ThemeLayout : : kLayoutHorizontal , 12 )
. addPadding ( 0 , 0 , 0 , 0 )
. addWidget ( " OutlookAdjustmentLabel " , " OptionsLabel " )
. addWidget ( " OutlookAdjustment " , " WideSlider " )
. addWidget ( " OutlookAdjustmentValue " , " ShortOptionsLabel " )
. closeLayout ( )
. closeLayout ( )
. closeDialog ( ) ;
2022-05-28 12:14:22 +00:00
}
void MI1CdGameOptionsWidget : : handleCommand ( GUI : : CommandSender * sender , uint32 cmd , uint32 data ) {
switch ( cmd ) {
case kIntroAdjustmentChanged :
updateIntroAdjustmentValue ( ) ;
break ;
case kOutlookAdjustmentChanged :
updateOutlookAdjustmentValue ( ) ;
break ;
default :
GUI : : OptionsContainerWidget : : handleCommand ( sender , cmd , data ) ;
break ;
}
}
void MI1CdGameOptionsWidget : : updateIntroAdjustmentValue ( ) {
updateAdjustmentSlider ( _introAdjustmentSlider , _introAdjustmentValue ) ;
}
void MI1CdGameOptionsWidget : : updateOutlookAdjustmentValue ( ) {
updateAdjustmentSlider ( _outlookAdjustmentSlider , _outlookAdjustmentValue ) ;
}
2003-10-09 14:17:06 +00:00
} // End of namespace Scumm