1 # GemRB - Infinity Engine Emulator
2 # Copyright (C) 2003 The GemRB Project
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #character generation, sounds (GUICG19)
20 from ie_restype
import *
26 # the available sounds
27 SoundSequence
= [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', \
28 'm', 's', 't', 'u', 'v', '_', 'x', 'y', 'z', '0', '1', '2', \
29 '3', '4', '5', '6', '7', '8', '9']
33 global CharSoundWindow
, VoiceList
35 GemRB
.LoadWindowPack("GUICG", 640, 480)
36 CharSoundWindow
=GemRB
.LoadWindow(19)
38 VoiceList
= CharSoundWindow
.GetControl (45)
39 VoiceList
.SetFlags (IE_GUI_TEXTAREA_SELECTABLE
)
40 if GemRB
.GetVar ("Gender")==1:
41 GemRB
.SetVar ("Selected", 4)
43 GemRB
.SetVar ("Selected", 0)
45 VoiceList
.SetVarAssoc ("Selected", 0)
46 RowCount
=VoiceList
.GetCharSounds()
48 PlayButton
= CharSoundWindow
.GetControl (47)
49 PlayButton
.SetState (IE_GUI_BUTTON_ENABLED
)
50 PlayButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, PlayPress
)
51 PlayButton
.SetText (17318)
53 TextArea
= CharSoundWindow
.GetControl (50)
54 TextArea
.SetText (11315)
56 BackButton
= CharSoundWindow
.GetControl(10)
57 BackButton
.SetText(15416)
58 BackButton
.SetFlags (IE_GUI_BUTTON_CANCEL
, OP_OR
)
59 DoneButton
= CharSoundWindow
.GetControl(0)
60 DoneButton
.SetText(11973)
61 DoneButton
.SetFlags(IE_GUI_BUTTON_DEFAULT
,OP_OR
)
63 VoiceList
.SetEvent(IE_GUI_TEXTAREA_ON_CHANGE
, ChangeVoice
)
64 DoneButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, NextPress
)
65 BackButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, BackPress
)
66 CharSoundWindow
.SetVisible(WINDOW_VISIBLE
)
70 global CharSoundWindow
, SoundIndex
, SoundSequence
72 CharSound
= VoiceList
.QueryText()
73 # SClassID.h -> IE_WAV_CLASS_ID = 0x00000004
74 while (not GemRB
.HasResource (CharSound
+ SoundSequence
[SoundIndex
], RES_WAV
)):
76 # play the sound like it was a speech, so any previous yells are quieted
77 GemRB
.PlaySound (CharSound
+ SoundSequence
[SoundIndex
], 0, 0, 4)
82 global SoundIndex
, SoundSequence
84 if SoundIndex
>= len(SoundSequence
):
88 # When a new voice is selected, play the sounds again from the beginning of the sequence
95 global CharSoundWindow
98 CharSoundWindow
.Unload()
99 GemRB
.SetNextScript("GUICG13")
103 global CharSoundWindow
105 CharSound
= VoiceList
.QueryText ()
106 MyChar
= GemRB
.GetVar ("Slot")
107 GemRB
.SetPlayerSound (MyChar
, CharSound
)
110 CharSoundWindow
.Unload()
111 GemRB
.SetNextScript("CharGen8") #name