From: <lyn...@us...> - 2008-06-26 16:37:41
|
Revision: 5215 http://gemrb.svn.sourceforge.net/gemrb/?rev=5215&view=rev Author: lynxlupodian Date: 2008-06-26 09:37:13 -0700 (Thu, 26 Jun 2008) Log Message: ----------- bg2: cg: play all the sounds in the voice set based on the patch from gnud Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/bg2/GUICG19.py Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUICG19.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUICG19.py 2008-06-26 15:55:26 UTC (rev 5214) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUICG19.py 2008-06-26 16:37:13 UTC (rev 5215) @@ -4,6 +4,12 @@ VoiceList = 0 CharSoundWindow = 0 +# the available sounds +SoundSequence = [ 'a', 'n', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', \ + 'm', 's', 't', 'u', 'v', '_', 'x', 'y', 'z', '0', '1', '2', \ + '3', '4', '5', '6', '7', '8', '9'] +SoundIndex = 0 + def OnLoad(): global CharSoundWindow, VoiceList @@ -34,18 +40,31 @@ GemRB.SetText(CharSoundWindow,DoneButton,11973) GemRB.SetButtonFlags(CharSoundWindow, DoneButton, IE_GUI_BUTTON_DEFAULT,OP_OR) + GemRB.SetEvent(CharSoundWindow, VoiceList, \ + IE_GUI_TEXTAREA_ON_CHANGE, "ChangeVoice") GemRB.SetEvent(CharSoundWindow,DoneButton,IE_GUI_BUTTON_ON_PRESS,"NextPress") GemRB.SetEvent(CharSoundWindow,BackButton,IE_GUI_BUTTON_ON_PRESS,"BackPress") GemRB.SetVisible(CharSoundWindow,1) return def PlayPress(): - global CharSoundWindow + global CharSoundWindow, SoundIndex, SoundSequence CharSound = GemRB.QueryText(CharSoundWindow, VoiceList) - GemRB.PlaySound (CharSound+"a") + # SClassID.h -> IE_WAV_CLASS_ID = 0x00000004 + while (not GemRB.HasResource (CharSound + SoundSequence[SoundIndex], 0x00000004)): + SoundIndex +=1 + GemRB.PlaySound (CharSound + SoundSequence[SoundIndex]) + SoundIndex +=1 + if SoundIndex >= len(SoundSequence): + SoundIndex = 0 return +# When a new voice is selected, play the sounds again from the beginning of the sequence +def ChangeVoice(): + global SoundIndex + SoundIndex = 0 + def BackPress(): global CharSoundWindow This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lyn...@us...> - 2008-06-26 17:02:08
|
Revision: 5217 http://gemrb.svn.sourceforge.net/gemrb/?rev=5217&view=rev Author: lynxlupodian Date: 2008-06-26 10:01:37 -0700 (Thu, 26 Jun 2008) Log Message: ----------- b2: cg: let's be safe and also not fail if the last sound is missing Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/bg2/GUICG19.py Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUICG19.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUICG19.py 2008-06-26 16:52:53 UTC (rev 5216) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUICG19.py 2008-06-26 17:01:37 UTC (rev 5217) @@ -5,7 +5,7 @@ CharSoundWindow = 0 # the available sounds -SoundSequence = [ 'a', 'n', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', \ +SoundSequence = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', \ 'm', 's', 't', 'u', 'v', '_', 'x', 'y', 'z', '0', '1', '2', \ '3', '4', '5', '6', '7', '8', '9'] SoundIndex = 0 @@ -53,12 +53,16 @@ CharSound = GemRB.QueryText(CharSoundWindow, VoiceList) # SClassID.h -> IE_WAV_CLASS_ID = 0x00000004 while (not GemRB.HasResource (CharSound + SoundSequence[SoundIndex], 0x00000004)): - SoundIndex +=1 + NextSound() GemRB.PlaySound (CharSound + SoundSequence[SoundIndex]) - SoundIndex +=1 + NextSound() + return + +def NextSound(): + global SoundIndex, SoundSequence + SoundIndex += 1 if SoundIndex >= len(SoundSequence): SoundIndex = 0 - return # When a new voice is selected, play the sounds again from the beginning of the sequence def ChangeVoice(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |