[Scummvm-cvs-logs] SF.net SVN: scummvm: [27388] scummvm/trunk/engines/saga

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Jun 13 21:41:28 CEST 2007


Revision: 27388
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27388&view=rev
Author:   thebluegr
Date:     2007-06-13 12:41:27 -0700 (Wed, 13 Jun 2007)

Log Message:
-----------
IHNM: Button textures are loaded correctly now for buttons in the option and quit panel. Also, implemented the voices/subtitles toggle functionality and fixed widget placement a bit

Modified Paths:
--------------
    scummvm/trunk/engines/saga/actor.cpp
    scummvm/trunk/engines/saga/detection_tables.h
    scummvm/trunk/engines/saga/displayinfo.h
    scummvm/trunk/engines/saga/interface.cpp
    scummvm/trunk/engines/saga/interface.h
    scummvm/trunk/engines/saga/itedata.cpp
    scummvm/trunk/engines/saga/itedata.h
    scummvm/trunk/engines/saga/saga.cpp
    scummvm/trunk/engines/saga/saga.h
    scummvm/trunk/engines/saga/sagaresnames.h
    scummvm/trunk/engines/saga/sndres.cpp

Modified: scummvm/trunk/engines/saga/actor.cpp
===================================================================
--- scummvm/trunk/engines/saga/actor.cpp	2007-06-13 15:31:45 UTC (rev 27387)
+++ scummvm/trunk/engines/saga/actor.cpp	2007-06-13 19:41:27 UTC (rev 27388)
@@ -1833,7 +1833,8 @@
 
 void Actor::drawSpeech(void) {
 	if (!isSpeaking() || !_activeSpeech.playing || _vm->_script->_skipSpeeches
-		|| (!_vm->_subtitlesEnabled && (_vm->getFeatures() & GF_CD_FX)))
+		|| (!_vm->_subtitlesEnabled && (_vm->getFeatures() & GF_CD_FX))
+		|| (!_vm->_subtitlesEnabled && (_vm->getGameType() == GType_IHNM)))
 		return;
 
 	int i;

Modified: scummvm/trunk/engines/saga/detection_tables.h
===================================================================
--- scummvm/trunk/engines/saga/detection_tables.h	2007-06-13 15:31:45 UTC (rev 27387)
+++ scummvm/trunk/engines/saga/detection_tables.h	2007-06-13 19:41:27 UTC (rev 27388)
@@ -31,9 +31,10 @@
 	RID_ITE_MAIN_PANEL,
 	RID_ITE_CONVERSE_PANEL,
 	RID_ITE_OPTION_PANEL,
-	0,
+	0,					// Warning panel (IHNM only)
 	RID_ITE_MAIN_SPRITES,
 	RID_ITE_MAIN_PANEL_SPRITES,
+	0,					// Option panel sprites (IHNM only)
 	RID_ITE_DEFAULT_PORTRAITS,
 	RID_ITE_MAIN_STRINGS,
 	RID_ITE_ACTOR_NAMES
@@ -45,9 +46,10 @@
 	RID_ITEDEMO_MAIN_PANEL,
 	RID_ITEDEMO_CONVERSE_PANEL,
 	RID_ITEDEMO_OPTION_PANEL,
-	0,
+	0,						// Warning panel (IHNM only)
 	RID_ITEDEMO_MAIN_SPRITES,
 	RID_ITEDEMO_MAIN_PANEL_SPRITES,
+	0,						// Option panel sprites (IHNM only)
 	RID_ITEDEMO_DEFAULT_PORTRAITS,
 	RID_ITEDEMO_MAIN_STRINGS,
 	RID_ITEDEMO_ACTOR_NAMES
@@ -292,9 +294,10 @@
 	RID_IHNM_WARNING_PANEL,
 	RID_IHNM_MAIN_SPRITES,
 	RID_IHNM_MAIN_PANEL_SPRITES,
-	0,
+	RID_IHNM_OPTION_PANEL_SPRITES,
+	0,					// Default portraits (ITE only)
 	RID_IHNM_MAIN_STRINGS,
-	0
+	0					// Actors strings (ITE only)
 };
 
 static const GameFontDescription IHNMDEMO_GameFonts[] = {

Modified: scummvm/trunk/engines/saga/displayinfo.h
===================================================================
--- scummvm/trunk/engines/saga/displayinfo.h	2007-06-13 15:31:45 UTC (rev 27387)
+++ scummvm/trunk/engines/saga/displayinfo.h	2007-06-13 19:41:27 UTC (rev 27388)
@@ -323,20 +323,19 @@
 };
 
 static PanelButton IHNM_OptionPanelButtons[] = {
-	//TODO: Add the rest of the buttons
 	{kPanelButtonOptionText,28,36,	0,0,	kTextReadingSpeed,'-',0, 0,0,0},	// text: read speed
 	{kPanelButtonOptionText,60,61,	0,0,	kTextMusic,'-',0, 0,0,0},			// text: music
 	{kPanelButtonOptionText,60,86,	0,0,	kTextSound,'-',0, 0,0,0},			// text: noise
-	// TODO: Add Voices text here
-	{kPanelButtonOption,	154,30, 79,23,	kTextReadingSpeed,'r',0,	0,0,0},	//read speed
-	{kPanelButtonOption,	154,55, 79,23,	kTextMusic,'m',0,	0,0,0},			//music
-	{kPanelButtonOption,	154,80, 79,23,	kTextSound,'n',0,	0,0,0},			//sound-noise
-	// TODO: Add Voices widget here
+	{kPanelButtonOptionText,56,111,	0,0,	kTextVoices,'-',0, 0,0,0},			// text: voices
+	{kPanelButtonOption,	153,29, 79,23,	kTextReadingSpeed,'r',0,	0,0,0},	//read speed
+	{kPanelButtonOption,	153,54, 79,23,	kTextMusic,'m',0,	0,0,0},			//music
+	{kPanelButtonOption,	153,79, 79,23,	kTextSound,'n',0,	0,0,0},			//sound-noise
+	{kPanelButtonOption,	153,104,79,23,	kTextVoices,'v',0,	0,0,0},			//voices
 	{kPanelButtonOption,	19,149,	200,25,	kTextQuitGame,'q',0,	0,0,0},		//quit
 	{kPanelButtonOption,	19,177,	200,25,	kTextContinuePlaying,'c',0,	0,0,0}, //continue
 	// TODO: Implement load/save
-	{kPanelButtonOption,	244,164, 79,23,	kTextLoad,'l',0,	0,0,0},			//load
-	{kPanelButtonOption,	335,164, 79,23,	kTextSave,'s',0,	0,0,0},			//save
+	{kPanelButtonOption,	242,162, 79,23,	kTextLoad,'l',0,	0,0,0},			//load
+	{kPanelButtonOption,	333,162, 79,23,	kTextSave,'s',0,	0,0,0},			//save
 };
 
 static PanelButton IHNM_QuitPanelButtons[] = {

Modified: scummvm/trunk/engines/saga/interface.cpp
===================================================================
--- scummvm/trunk/engines/saga/interface.cpp	2007-06-13 15:31:45 UTC (rev 27387)
+++ scummvm/trunk/engines/saga/interface.cpp	2007-06-13 19:41:27 UTC (rev 27388)
@@ -142,6 +142,8 @@
 
 	// Main panel sprites
 	_vm->_sprite->loadList(_vm->getResourceDescription()->mainPanelSpritesResourceId, _mainPanel.sprites);
+	// Option panel sprites
+	_vm->_sprite->loadList(_vm->getResourceDescription()->optionPanelSpritesResourceId, _optionPanel.sprites);
 
 	if (_vm->getGameType() == GType_ITE) {
 		_vm->_sprite->loadList(_vm->getResourceDescription()->defaultPortraitsResourceId, _defPortraits);
@@ -755,7 +757,8 @@
 	PanelButton *panelButton;
 	Point textPoint;
 	Point point;
-	
+	int spritenum = 0;
+
 	backBuffer = _vm->_gfx->getBackBuffer();
 
 	_optionPanel.getRect(rect);
@@ -764,16 +767,13 @@
 	for (i = 0; i < _optionPanel.buttonsCount; i++) {
 		panelButton = &_optionPanel.buttons[i];
 
-		// TODO: This probably works for the button background, but the resources are still not loeaded
-		// (_optionPanel.sprites)
-		/*
-		point.x = _optionPanel.x + panelButton->xOffset;
-		point.y = _optionPanel.y + panelButton->yOffset;
-		_vm->_sprite->draw(backBuffer, _vm->getDisplayClip(), _optionPanel.sprites, i, point, 256);
-		*/
-
 		if (panelButton->type == kPanelButtonOption) {
-			drawPanelButtonText(backBuffer, &_optionPanel, panelButton);
+			if (_vm->getGameType() == GType_ITE) {
+				drawPanelButtonText(backBuffer, &_optionPanel, panelButton);
+			} else {
+				drawPanelButtonText(backBuffer, &_optionPanel, panelButton, spritenum);
+				spritenum += 2; // 2 sprites per button (lit and unlit)
+			}
 		}
 		if (panelButton->type == kPanelButtonOptionText) {
 			drawPanelText(backBuffer, &_optionPanel, panelButton);
@@ -781,11 +781,8 @@
 	}
 
 	if (_optionSaveRectTop.height() > 0) {
-		if (_vm->getGameType() == GType_ITE) {
+		if (_vm->getGameType() == GType_ITE)
 			backBuffer->drawRect(_optionSaveRectTop, kITEColorDarkGrey);
-		} else {
-			// TODO: Draw the button graphic properly for IHNM
-		}
 	}
 
 	// FIXME: The _optionSaveFileSlider checks exist for IHNM, where 
@@ -1399,6 +1396,21 @@
 		_vm->_sound->setVolume(_vm->_soundVolume == 10 ? 255 : _vm->_soundVolume * 25);
 		ConfMan.setInt("sfx_volume", _vm->_soundVolume * 25);
 		break;
+	case kTextVoices:
+		if (_vm->_subtitlesEnabled && _vm->_voicesEnabled) {		// Both
+			_vm->_subtitlesEnabled = false;							// Set it to "Audio"
+			_vm->_voicesEnabled = true;								// Not necessary, just for completeness
+		} else if (!_vm->_subtitlesEnabled && _vm->_voicesEnabled) {
+			_vm->_subtitlesEnabled = true;							// Set it to "Text"
+			_vm->_voicesEnabled = false;
+		} else if (_vm->_subtitlesEnabled && !_vm->_voicesEnabled) {
+			_vm->_subtitlesEnabled = true;							// Set it to "Both"
+			_vm->_voicesEnabled = true;
+		}
+
+		ConfMan.setBool("subtitles", _vm->_subtitlesEnabled);
+		ConfMan.setBool("voices", _vm->_voicesEnabled);
+		break;
 	}
 }
 
@@ -1917,14 +1929,16 @@
 
 static const int readingSpeeds[] = { kTextClick, kTextSlow, kTextMid, kTextFast };
 
-void Interface::drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelButton *panelButton) {
+void Interface::drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelButton *panelButton, int spritenum) {
 	const char *text;
 	int textId;
 	int textWidth;
 	int textHeight;
 	Point point;
+	Point texturePoint;
 	KnownColor textColor;
 	Rect rect;
+	int litButton = 0;
 
 	textId = panelButton->id;
 	switch (panelButton->id) {
@@ -1950,6 +1964,14 @@
 		else
 			textId = kTextOff;
 		break;
+	case kTextVoices:
+		if (_vm->_subtitlesEnabled && _vm->_voicesEnabled)
+			textId = kTextBoth;
+		else if (_vm->_subtitlesEnabled && !_vm->_voicesEnabled)
+			textId = kTextText;
+		else if (!_vm->_subtitlesEnabled && _vm->_voicesEnabled)
+			textId = kTextAudio;
+		break;
 	}
 	text = _vm->getTextString(textId);
 
@@ -1971,8 +1993,25 @@
 	}
 
 	panel->calcPanelButtonRect(panelButton, rect);
-	drawButtonBox(ds, rect, kButton, panelButton->state > 0);
+	if (_vm->getGameType() == GType_ITE) {
+		drawButtonBox(ds, rect, kButton, panelButton->state > 0);
+	} else {
+		litButton = panelButton->state > 0;
 
+		if (panel == &_optionPanel) {
+			texturePoint.x = _optionPanel.x + panelButton->xOffset;
+			texturePoint.y = _optionPanel.y + panelButton->yOffset;
+			_vm->_sprite->draw(ds, _vm->getDisplayClip(), _optionPanel.sprites, spritenum + 2 + litButton, texturePoint, 256);
+		} else if (panel == &_quitPanel) {
+			texturePoint.x = _quitPanel.x + panelButton->xOffset;
+			texturePoint.y = _quitPanel.y + panelButton->yOffset;
+			_vm->_sprite->draw(ds, _vm->getDisplayClip(), _optionPanel.sprites, 14 + litButton, texturePoint, 256);
+		} else {
+			// revert to default behavior
+			drawButtonBox(ds, rect, kButton, panelButton->state > 0);
+		}
+	}
+
 	if (_vm->getGameType() == GType_ITE)
 		_vm->_font->textDraw(kKnownFontMedium, ds, text, point,
 			_vm->KnownColor2ColorId(textColor), _vm->KnownColor2ColorId(kKnownColorVerbTextShadow), kFontShadow);

Modified: scummvm/trunk/engines/saga/interface.h
===================================================================
--- scummvm/trunk/engines/saga/interface.h	2007-06-13 15:31:45 UTC (rev 27387)
+++ scummvm/trunk/engines/saga/interface.h	2007-06-13 19:41:27 UTC (rev 27388)
@@ -330,7 +330,7 @@
 
 	void drawTextInput(Surface *ds, InterfacePanel *panel, PanelButton *panelButton);
 	void drawPanelText(Surface *ds, InterfacePanel *panel, PanelButton *panelButton);
-	void drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelButton *panelButton);
+	void drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelButton *panelButton, int spritenum = 0);
 	enum ButtonKind {
 		kButton,
 		kSlider,

Modified: scummvm/trunk/engines/saga/itedata.cpp
===================================================================
--- scummvm/trunk/engines/saga/itedata.cpp	2007-06-13 15:31:45 UTC (rev 27387)
+++ scummvm/trunk/engines/saga/itedata.cpp	2007-06-13 19:41:27 UTC (rev 27388)
@@ -336,7 +336,7 @@
 	{ FX_CROWD_17,      64 }
 };
 
-const char *ITEinterfaceTextStrings[][52] = {
+const char *ITEinterfaceTextStrings[][56] = {
 	{
 		"Walk to", "Look At", "Pick Up", "Talk to", "Open",
 		"Close", "Use", "Give", "Options", "Test",
@@ -354,7 +354,9 @@
 		"There's no opening to close.",
 		"I don't know how to do that.",
 		"Show Dialog",
-		"What is Rif's reply?"
+		"What is Rif's reply?",
+		"Voices",				// IHNM
+		"Both", "Text", "Audio"	// IHNM
 	},
 	// German
 	{
@@ -374,7 +376,9 @@
 		"Hier ist keine \231ffnung zum Schlie$en.",
 		"Ich wei$ nicht, wie ich das machen soll.",
 		"Text zeigen",
-		"Wie lautet die Antwort?"
+		"Wie lautet die Antwort?",
+		"Sprache",					// IHNM
+		"Beides", "Text", "Stimmen"	// IHNM
 	}
 };
 

Modified: scummvm/trunk/engines/saga/itedata.h
===================================================================
--- scummvm/trunk/engines/saga/itedata.h	2007-06-13 15:31:45 UTC (rev 27387)
+++ scummvm/trunk/engines/saga/itedata.h	2007-06-13 19:41:27 UTC (rev 27388)
@@ -91,7 +91,7 @@
 extern ObjectTableData ITE_ObjectTable[ITE_OBJECTCOUNT];
 extern FxTable ITE_SfxTable[ITE_SFXCOUNT];
 
-extern const char *ITEinterfaceTextStrings[][52];
+extern const char *ITEinterfaceTextStrings[][56];
 
 #define PUZZLE_PIECES 15
 

Modified: scummvm/trunk/engines/saga/saga.cpp
===================================================================
--- scummvm/trunk/engines/saga/saga.cpp	2007-06-13 15:31:45 UTC (rev 27387)
+++ scummvm/trunk/engines/saga/saga.cpp	2007-06-13 19:41:27 UTC (rev 27388)
@@ -148,6 +148,16 @@
 	_soundVolume = ConfMan.getInt("sfx_volume") / 25;
 	_musicVolume = ConfMan.getInt("music_volume") / 25;
 	_subtitlesEnabled = ConfMan.getBool("subtitles");
+	if (getGameType() == GType_IHNM) {
+		if (!ConfMan.hasKey("voices")) {
+			_voicesEnabled = true;
+			ConfMan.setBool("voices", true);
+		} else {
+			_voicesEnabled = ConfMan.getBool("voices");
+		}
+	} else {
+		_voicesEnabled = true;
+	}
 	_readingSpeed = getTalkspeed();
 	_copyProtection = ConfMan.getBool("copy_protection");
 

Modified: scummvm/trunk/engines/saga/saga.h
===================================================================
--- scummvm/trunk/engines/saga/saga.h	2007-06-13 15:31:45 UTC (rev 27387)
+++ scummvm/trunk/engines/saga/saga.h	2007-06-13 19:41:27 UTC (rev 27388)
@@ -279,7 +279,11 @@
 	kTextNoOpening,
 	kTextDontKnow,
 	kTextShowDialog,
-	kTextEnterProtectAnswer
+	kTextEnterProtectAnswer,
+	kTextVoices,
+	kTextBoth,
+	kTextText,
+	kTextAudio
 };
 
 
@@ -292,6 +296,7 @@
 	uint32 warningPanelResourceId;
 	uint32 mainSpritesResourceId;
 	uint32 mainPanelSpritesResourceId;
+	uint32 optionPanelSpritesResourceId;
 	uint32 defaultPortraitsResourceId;
 	uint32 mainStringsResourceId;
 	uint32 actorsStringsResourceId;
@@ -518,6 +523,7 @@
 	int _soundVolume;
 	int _musicVolume;
 	bool _subtitlesEnabled;
+	bool _voicesEnabled;
 	int _readingSpeed;
 
 	bool _copyProtection;

Modified: scummvm/trunk/engines/saga/sagaresnames.h
===================================================================
--- scummvm/trunk/engines/saga/sagaresnames.h	2007-06-13 15:31:45 UTC (rev 27387)
+++ scummvm/trunk/engines/saga/sagaresnames.h	2007-06-13 19:41:27 UTC (rev 27388)
@@ -104,6 +104,7 @@
 #define RID_IHNM_ARROW_SPRITES 13
 #define RID_IHNM_SAVEREMINDER_SPRITES 14
 #define RID_IHNM_OPTION_PANEL 15
+#define RID_IHNM_OPTION_PANEL_SPRITES 16
 #define RID_IHNM_WARNING_PANEL 17
 #define RID_IHNM_BOSS_SCREEN 19
 #define RID_IHNM_PROFILE_BG 20

Modified: scummvm/trunk/engines/saga/sndres.cpp
===================================================================
--- scummvm/trunk/engines/saga/sndres.cpp	2007-06-13 15:31:45 UTC (rev 27387)
+++ scummvm/trunk/engines/saga/sndres.cpp	2007-06-13 19:41:27 UTC (rev 27388)
@@ -126,6 +126,9 @@
 void SndRes::playVoice(uint32 resourceId) {
 	SoundBuffer buffer;
 
+	if (_vm->getGameType() == GType_IHNM && !(_vm->_voicesEnabled))
+		return;
+
 	debug(4, "SndRes::playVoice %i", resourceId);
 
 	if (!load(_voiceContext, resourceId, buffer, false)) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list