~ubuntu-branches/ubuntu/precise/fofix-dfsg/precise

« back to all changes in this revision

Viewing changes to src/Settings.py

  • Committer: Bazaar Package Importer
  • Author(s): Christian Hammers
  • Date: 2010-02-21 12:09:32 UTC
  • Revision ID: james.westby@ubuntu.com-20100221120932-6bh992d2u8dtj9gr
Tags: upstream-3.121
ImportĀ upstreamĀ versionĀ 3.121

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#####################################################################
 
2
# -*- coding: iso-8859-1 -*-                                        #
 
3
#                                                                   #
 
4
# Frets on Fire                                                     #
 
5
# Copyright (C) 2006 Sami Kyļæ½stilļæ½                                  #
 
6
#               2008 Alarian                                        #
 
7
#               2008 myfingershurt                                  #
 
8
#               2008 Spikehead777                                   #
 
9
#               2008 Glorandwarf                                    #
 
10
#               2008 ShiekOdaSandz                                  #
 
11
#               2008 QQStarS                                        #
 
12
#               2008 Blazingamer                                    #
 
13
#               2008 evilynux <evilynux@gmail.com>                  #
 
14
#               2008 fablaculp                                      #
 
15
#                                                                   #
 
16
# This program is free software; you can redistribute it and/or     #
 
17
# modify it under the terms of the GNU General Public License       #
 
18
# as published by the Free Software Foundation; either version 2    #
 
19
# of the License, or (at your option) any later version.            #
 
20
#                                                                   #
 
21
# This program is distributed in the hope that it will be useful,   #
 
22
# but WITHOUT ANY WARRANTY; without even the implied warranty of    #
 
23
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     #
 
24
# GNU General Public License for more details.                      #
 
25
#                                                                   #
 
26
# You should have received a copy of the GNU General Public License #
 
27
# along with this program; if not, write to the Free Software       #
 
28
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,        #
 
29
# MA  02110-1301, USA.                                              #
 
30
#####################################################################
 
31
 
 
32
import Menu
 
33
from Language import _
 
34
import Dialogs
 
35
import Config
 
36
import Mod
 
37
import Audio
 
38
import Player
 
39
from View import BackgroundLayer
 
40
from Input import KeyListener
 
41
from Song import VOCAL_PART
 
42
 
 
43
import pygame
 
44
import os
 
45
 
 
46
import Log
 
47
 
 
48
import Theme
 
49
 
 
50
class ConfigChoice(Menu.Choice):
 
51
  def __init__(self, engine, config, section, option, autoApply = False, isQuickset = 0):
 
52
    self.engine    = engine
 
53
    self.config    = config
 
54
    
 
55
    self.logClassInits = self.engine.config.get("game", "log_class_inits")
 
56
    if self.logClassInits == 1:
 
57
      Log.debug("ConfigChoice class init (Settings.py)...")
 
58
    
 
59
    self.section    = section
 
60
    self.option     = option
 
61
    self.changed    = False
 
62
    self.value      = None
 
63
    self.autoApply  = autoApply
 
64
    self.isQuickset = isQuickset
 
65
    tipText = config.getTipText(section, option)
 
66
    o = config.prototype[section][option]
 
67
    v = config.get(section, option)
 
68
    if isinstance(o.options, dict):
 
69
      values     = o.options.values()
 
70
      values.sort()
 
71
      try:
 
72
        valueIndex = values.index(o.options[v])
 
73
      except KeyError:
 
74
        valueIndex = 0
 
75
    elif isinstance(o.options, list):
 
76
      values     = o.options
 
77
      try:
 
78
        valueIndex = values.index(v)
 
79
      except ValueError:
 
80
        valueIndex = 0
 
81
    else:
 
82
      raise RuntimeError("No usable options for %s.%s." % (section, option))
 
83
    Menu.Choice.__init__(self, text = o.text, callback = self.change, values = values, valueIndex = valueIndex, tipText = tipText)
 
84
    
 
85
  def change(self, value):
 
86
    o = self.config.prototype[self.section][self.option]
 
87
    
 
88
    if isinstance(o.options, dict):
 
89
      for k, v in o.options.items():
 
90
        if v == value:
 
91
          value = k
 
92
          break
 
93
    
 
94
    self.changed = True
 
95
    self.value   = value
 
96
    
 
97
    if self.isQuickset == 1: # performance quickset
 
98
      self.config.set("quickset","performance",0)
 
99
      self.engine.quicksetPerf = 0
 
100
    elif self.isQuickset == 2: # gameplay quickset
 
101
      self.config.set("quickset","gameplay",0)
 
102
    
 
103
    if self.section == "quickset":
 
104
      if self.option == "performance":
 
105
        if self.value == self.engine.quicksetPerf or self.value == 0:
 
106
          self.engine.quicksetRestart = False
 
107
        else:
 
108
          self.engine.quicksetRestart = True
 
109
    
 
110
    self.apply()  #stump: it wasn't correctly saving some "restart required" settings
 
111
    if not self.autoApply:
 
112
      self.engine.restartRequired = True
 
113
 
 
114
  def apply(self):
 
115
    if self.changed:
 
116
      self.config.set(self.section, self.option, self.value)
 
117
 
 
118
class ActiveConfigChoice(ConfigChoice):
 
119
  """
 
120
  ConfigChoice with an additional callback function.
 
121
  """
 
122
  def __init__(self, engine, config, section, option, onChange, autoApply = True, volume = False):
 
123
    ConfigChoice.__init__(self, engine, config, section, option, autoApply = autoApply)
 
124
    self.engine   = engine
 
125
    self.onChange = onChange
 
126
    self.volume   = volume
 
127
    
 
128
    self.logClassInits = self.engine.config.get("game", "log_class_inits")
 
129
    if self.logClassInits == 1:
 
130
      Log.debug("ActiveConfigChoice class init (Settings.py)...")
 
131
  
 
132
  def change(self, value):
 
133
    ConfigChoice.change(self, value)
 
134
    if self.volume:
 
135
      sound = self.engine.data.screwUpSound
 
136
      sound.setVolume(self.value)
 
137
      sound.play()
 
138
  
 
139
  def apply(self):
 
140
    ConfigChoice.apply(self)
 
141
    self.onChange()
 
142
 
 
143
class VolumeConfigChoice(ConfigChoice):
 
144
  def __init__(self, engine, config, section, option, autoApply = False):
 
145
    ConfigChoice.__init__(self, engine, config, section, option, autoApply)
 
146
    self.engine = engine
 
147
 
 
148
    self.logClassInits = self.engine.config.get("game", "log_class_inits")
 
149
    if self.logClassInits == 1:
 
150
      Log.debug("VolumeConfigChoice class init (Settings.py)...")
 
151
    
 
152
 
 
153
  def change(self, value):
 
154
    ConfigChoice.change(self, value)
 
155
    sound = self.engine.data.screwUpSound
 
156
    sound.setVolume(self.value)
 
157
    sound.play()
 
158
 
 
159
class KeyConfigChoice(Menu.Choice):
 
160
  def __init__(self, engine, config, section, option, noneOK = False, shift = None):
 
161
    self.engine  = engine
 
162
 
 
163
    self.logClassInits = self.engine.config.get("game", "log_class_inits")
 
164
    if self.logClassInits == 1:
 
165
      Log.debug("KeyConfigChoice class init (Settings.py)...")
 
166
 
 
167
    self.config  = config
 
168
    self.section = section
 
169
    self.option  = option
 
170
    self.changed = False
 
171
    self.value   = None
 
172
    self.noneOK  = noneOK
 
173
    self.shift   = shift
 
174
    self.type    = self.config.get("controller", "type")
 
175
    self.name    = self.config.get("controller", "name")
 
176
    self.frets   = []
 
177
    
 
178
    def keycode(k):
 
179
      try:
 
180
        return int(k)
 
181
      except:
 
182
        return getattr(pygame, k)
 
183
    
 
184
    if self.shift:
 
185
      self.frets.append(keycode(self.config.get("controller", "key_1")))
 
186
      self.frets.append(keycode(self.config.get("controller", "key_2")))
 
187
      self.frets.append(keycode(self.config.get("controller", "key_3")))
 
188
      self.frets.append(keycode(self.config.get("controller", "key_4")))
 
189
      self.frets.append(keycode(self.config.get("controller", "key_5")))
 
190
 
 
191
    self.keyCheckerMode = self.config.get("game","key_checker_mode")
 
192
 
 
193
    self.option = self.option
 
194
      
 
195
    Menu.Choice.__init__(self, text = "", callback = self.change)
 
196
 
 
197
  def getText(self, selected):
 
198
    def keycode(k):
 
199
      try:
 
200
        return int(k)
 
201
      except:
 
202
        return getattr(pygame, k)
 
203
    o = self.config.prototype[self.section][self.option]
 
204
    v = self.config.get(self.section, self.option)
 
205
    if isinstance(o.text, tuple):
 
206
      type = self.type
 
207
      if len(o.text) == 5:
 
208
        text = o.text[type]
 
209
      else:
 
210
        if type == 4:
 
211
          type = 0
 
212
      if len(o.text) == 4:
 
213
        text = o.text[type]
 
214
      elif len(o.text) == 3:
 
215
        text = o.text[max(0, type-1)]
 
216
      elif len(o.text) == 2:
 
217
        if type < 2:
 
218
          text = o.text[0]
 
219
        else:
 
220
          text = o.text[1]
 
221
    else:
 
222
      text = o.text
 
223
    if v == "None":
 
224
      keyname = "Disabled"
 
225
    else:
 
226
      keyname = pygame.key.name(keycode(v)).capitalize()
 
227
    return "%s: %s" % (text, keyname)
 
228
    
 
229
  def change(self):
 
230
    o = self.config.prototype[self.section][self.option]
 
231
 
 
232
    if isinstance(o.options, dict):
 
233
      for k, v in o.options.items():
 
234
        if v == value:
 
235
          value = k
 
236
          break
 
237
    if isinstance(o.text, tuple):
 
238
      type = self.type
 
239
      if len(o.text) == 5:
 
240
        text = o.text[type]
 
241
      else:
 
242
        if type == 4:
 
243
          type = 0
 
244
      if len(o.text) == 4:
 
245
        text = o.text[type]
 
246
      elif len(o.text) == 3:
 
247
        text = o.text[max(0, type-1)]
 
248
      elif len(o.text) == 2:
 
249
        if type < 2:
 
250
          text = o.text[0]
 
251
        else:
 
252
          text = o.text[1]
 
253
    else:
 
254
      text = o.text
 
255
    if self.shift:
 
256
      key = Dialogs.getKey(self.engine, self.shift, specialKeyList = self.frets)
 
257
    else:
 
258
      if self.noneOK:
 
259
        key = Dialogs.getKey(self.engine, _("Press a key for '%s' or hold Escape to disable.") % text)
 
260
      else:
 
261
        key = Dialogs.getKey(self.engine, _("Press a key for '%s' or hold Escape to cancel.") % text)
 
262
    
 
263
    if key:
 
264
      #------------------------------------------
 
265
      
 
266
      #myfingershurt: key conflict checker operation mode
 
267
      #if self.keyCheckerMode == 2:    #enforce; do not allow conflicting key assignments, force reversion
 
268
        # glorandwarf: sets the new key mapping and checks for a conflict
 
269
        #if self.engine.input.setNewKeyMapping(self.section, self.option, key) == False:
 
270
          # key mapping would conflict, warn the user
 
271
          #Dialogs.showMessage(self.engine, _("That key is already in use. Please choose another."))
 
272
        #self.engine.input.reloadControls()
 
273
 
 
274
      #elif self.keyCheckerMode == 1:    #just notify, but allow the change
 
275
        # glorandwarf: sets the new key mapping and checks for a conflict
 
276
        #if self.engine.input.setNewKeyMapping(self.section, self.option, key) == False:
 
277
          # key mapping would conflict, warn the user
 
278
          #Dialogs.showMessage(self.engine, _("A key conflict exists somewhere. You should fix it."))
 
279
        #self.engine.input.reloadControls()
 
280
      
 
281
      #else:   #don't even check.
 
282
      temp = Player.setNewKeyMapping(self.engine, self.config, self.section, self.option, key)
 
283
      if self.name in self.engine.input.controls.controlList:
 
284
        self.engine.input.reloadControls()
 
285
    else:
 
286
      if self.noneOK:
 
287
        temp = Player.setNewKeyMapping(self.engine, self.config, self.section, self.option, "None")
 
288
        if self.name in self.engine.input.controls.controlList:
 
289
          self.engine.input.reloadControls()
 
290
      
 
291
      
 
292
      #------------------------------------------
 
293
 
 
294
  def apply(self):
 
295
    pass
 
296
 
 
297
def chooseControl(engine, mode = "edit", refresh = None):
 
298
  """
 
299
  Ask the user to choose a controller for editing or deletion.
 
300
  
 
301
  @param engine:    Game engine
 
302
  @param mode:      "edit" or "delete" controller
 
303
  """
 
304
  mode     = mode == "delete" and 1 or 0
 
305
  options  = []
 
306
  for i in Player.controllerDict.keys():
 
307
    if i != "defaultg" and i != "None" and i != "defaultd" and i != "defaultm":
 
308
      options.append(i)
 
309
  options.sort()
 
310
  if len(options) == 0:
 
311
    Dialogs.showMessage(engine, _("No Controllers Found."))
 
312
    return
 
313
  d = ControlChooser(engine, mode, options)
 
314
  Dialogs._runDialog(engine, d)
 
315
  if refresh:
 
316
    refresh()
 
317
 
 
318
def createControl(engine, control = "", edit = False, refresh = None):
 
319
  d = ControlCreator(engine, control, edit = edit)
 
320
  Dialogs._runDialog(engine, d)
 
321
  if refresh:
 
322
    refresh()
 
323
 
 
324
class ControlChooser(Menu.Menu):
 
325
  def __init__(self, engine, mode, options):
 
326
    self.engine  = engine
 
327
    self.mode    = mode
 
328
    self.options = options
 
329
    self.default = self.engine.config.get("game", "control0")
 
330
    
 
331
    self.logClassInits = self.engine.config.get("game", "log_class_inits")
 
332
    if self.logClassInits == 1:
 
333
      Log.debug("ControlChooser class init (Settings.py)...")
 
334
    
 
335
    self.selected = None
 
336
    self.d        = None
 
337
    self.creating = False
 
338
    self.time     = 0.0
 
339
 
 
340
    Menu.Menu.__init__(self, self.engine, choices = [(c, self._callbackForItem(c)) for c in options])
 
341
    if self.default in options:
 
342
      self.selectItem(options.index(self.default))
 
343
    
 
344
  def _callbackForItem(self, item):
 
345
    def cb():
 
346
      self.choose(item)
 
347
    return cb
 
348
    
 
349
  def choose(self, item):
 
350
    self.selected = item
 
351
    if self.mode == 0:
 
352
      createControl(self.engine, self.selected, edit = True)
 
353
      self.engine.view.popLayer(self)
 
354
    else:
 
355
      self.delete(self.selected)
 
356
  
 
357
  def delete(self, item):
 
358
    tsYes = _("Yes")
 
359
    q = Dialogs.chooseItem(self.engine, [tsYes, _("No")], _("Are you sure you want to delete this controller?"))
 
360
    if q == tsYes:
 
361
      Player.deleteControl(item)
 
362
      self.engine.view.popLayer(self)
 
363
 
 
364
class ControlCreator(BackgroundLayer, KeyListener):
 
365
  def __init__(self, engine, control = "", edit = False):
 
366
    self.engine  = engine
 
367
    self.control = control
 
368
    self.edit    = edit
 
369
    self.logClassInits = self.engine.config.get("game", "log_class_inits")
 
370
    if self.logClassInits == 1:
 
371
      Log.debug("ControlCreator class init (Settings.py)...")
 
372
    
 
373
    self.time   = 0.0
 
374
    self.badname     = ["defaultg", "defaultd", "defaultm"] #ensures that defaultm is included - duplicate is ok
 
375
    for i in Player.controllerDict.keys():
 
376
      self.badname.append(i.lower())
 
377
    
 
378
    self.menu = None
 
379
    self.config = None
 
380
  
 
381
  def shown(self):
 
382
    while (self.control.strip().lower() in self.badname or self.control.strip() == "") and not self.edit:
 
383
      self.control = Dialogs.getText(self.engine, _("Please name your controller"), self.control)
 
384
      if self.control.strip().lower() in self.badname:
 
385
        Dialogs.showMessage(self.engine, _("That name is already taken."))
 
386
      elif self.control.strip() == "":
 
387
        Dialogs.showMessage(self.engine, _("Canceled."))
 
388
        self.cancel()
 
389
        break
 
390
    else:
 
391
      self.setupMenu()
 
392
  
 
393
  def cancel(self):
 
394
    Player.loadControls()
 
395
    self.engine.input.reloadControls()
 
396
    self.engine.view.popLayer(self.menu)
 
397
    self.engine.view.popLayer(self)
 
398
  
 
399
  def setupMenu(self):
 
400
    self.config = None
 
401
    if not os.path.isfile(os.path.join(Player.controlpath, self.control + ".ini")):
 
402
      cr = open(os.path.join(Player.controlpath, self.control + ".ini"),"w")
 
403
      cr.close()
 
404
    self.config = Config.load(os.path.join(Player.controlpath, self.control + ".ini"), type = 1)
 
405
    name = self.config.get("controller", "name")
 
406
    if name != self.control:
 
407
      self.config.set("controller", "name", self.control)
 
408
    type = self.config.get("controller", "type")
 
409
    
 
410
    if type != 5:
 
411
      if str(self.config.get("controller", "key_1")) == "None":
 
412
        self.config.set("controller", "key_1", self.config.getDefault("controller", "key_1"))
 
413
      if str(self.config.get("controller", "key_2")) == "None":
 
414
        self.config.set("controller", "key_2", self.config.getDefault("controller", "key_2"))
 
415
      if str(self.config.get("controller", "key_3")) == "None":
 
416
        self.config.set("controller", "key_3", self.config.getDefault("controller", "key_3"))
 
417
      if str(self.config.get("controller", "key_4")) == "None":
 
418
        self.config.set("controller", "key_4", self.config.getDefault("controller", "key_4"))
 
419
      if str(self.config.get("controller", "key_action1")) == "None":
 
420
        self.config.set("controller", "key_action1", self.config.getDefault("controller", "key_action1"))
 
421
      if str(self.config.get("controller", "key_action2")) == "None":
 
422
        self.config.set("controller", "key_action2", self.config.getDefault("controller", "key_action2"))
 
423
    
 
424
    if type == 0:
 
425
      self.config.set("controller", "key_1a", None)
 
426
      if str(self.config.get("controller", "key_5")) == "None":
 
427
        self.config.set("controller", "key_5", self.config.getDefault("controller", "key_5"))
 
428
      if str(self.config.get("controller", "key_kill")) == "None":
 
429
        self.config.set("controller", "key_kill", self.config.getDefault("controller", "key_kill"))
 
430
      controlKeys = [
 
431
        ActiveConfigChoice(self.engine, self.config, "controller", "type", self.changeType),
 
432
        KeyConfigChoice(self.engine, self.config, "controller", "key_action1"),
 
433
        KeyConfigChoice(self.engine, self.config, "controller", "key_action2"),
 
434
        KeyConfigChoice(self.engine, self.config, "controller", "key_1"),
 
435
        KeyConfigChoice(self.engine, self.config, "controller", "key_2"),
 
436
        KeyConfigChoice(self.engine, self.config, "controller", "key_3"),
 
437
        KeyConfigChoice(self.engine, self.config, "controller", "key_4"),
 
438
        KeyConfigChoice(self.engine, self.config, "controller", "key_5"),
 
439
        KeyConfigChoice(self.engine, self.config, "controller", "key_1a", True),
 
440
        KeyConfigChoice(self.engine, self.config, "controller", "key_2a", True),
 
441
        KeyConfigChoice(self.engine, self.config, "controller", "key_3a", True),
 
442
        KeyConfigChoice(self.engine, self.config, "controller", "key_4a", True),
 
443
        KeyConfigChoice(self.engine, self.config, "controller", "key_5a", True),
 
444
        KeyConfigChoice(self.engine, self.config, "controller", "key_left", True),
 
445
        KeyConfigChoice(self.engine, self.config, "controller", "key_right", True),
 
446
        KeyConfigChoice(self.engine, self.config, "controller", "key_up", True),
 
447
        KeyConfigChoice(self.engine, self.config, "controller", "key_down", True),
 
448
        KeyConfigChoice(self.engine, self.config, "controller", "key_cancel"),
 
449
        KeyConfigChoice(self.engine, self.config, "controller", "key_start"),
 
450
        KeyConfigChoice(self.engine, self.config, "controller", "key_star", True),
 
451
        KeyConfigChoice(self.engine, self.config, "controller", "key_kill"),
 
452
        ConfigChoice(   self.engine, self.config, "controller", "analog_kill", autoApply = True),
 
453
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp", autoApply = True),
 
454
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp_threshold", autoApply = True),
 
455
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp_sensitivity", autoApply = True),
 
456
        #ConfigChoice(   self.engine, self.config, "controller", "analog_fx", autoApply = True),
 
457
        ConfigChoice(   self.engine, self.config, "controller", "two_chord_max", autoApply = True),
 
458
        (_("Rename Controller"), self.renameController),
 
459
      ]
 
460
    elif type == 1:
 
461
      self.config.set("controller", "key_2a", None)
 
462
      self.config.set("controller", "key_3a", None)
 
463
      self.config.set("controller", "key_4a", None)
 
464
      self.config.set("controller", "key_5a", None)
 
465
      if str(self.config.get("controller", "key_5")) == "None":
 
466
        self.config.set("controller", "key_5", self.config.getDefault("controller", "key_5"))
 
467
      if str(self.config.get("controller", "key_1a")) == "None":
 
468
        self.config.set("controller", "key_1a", self.config.getDefault("controller", "key_1a"))
 
469
      if str(self.config.get("controller", "key_kill")) == "None":
 
470
        self.config.set("controller", "key_kill", self.config.getDefault("controller", "key_kill"))
 
471
      
 
472
      controlKeys = [
 
473
        ActiveConfigChoice(self.engine, self.config, "controller", "type", self.changeType),
 
474
        KeyConfigChoice(self.engine, self.config, "controller", "key_action1"),
 
475
        KeyConfigChoice(self.engine, self.config, "controller", "key_action2"),
 
476
        KeyConfigChoice(self.engine, self.config, "controller", "key_1"),
 
477
        KeyConfigChoice(self.engine, self.config, "controller", "key_2"),
 
478
        KeyConfigChoice(self.engine, self.config, "controller", "key_3"),
 
479
        KeyConfigChoice(self.engine, self.config, "controller", "key_4"),
 
480
        KeyConfigChoice(self.engine, self.config, "controller", "key_5"),
 
481
        KeyConfigChoice(self.engine, self.config, "controller", "key_1a", shift = _("Press the solo shift key. Be sure to assign the frets first! Hold Escape to cancel.")),
 
482
        KeyConfigChoice(self.engine, self.config, "controller", "key_left", True),
 
483
        KeyConfigChoice(self.engine, self.config, "controller", "key_right", True),
 
484
        KeyConfigChoice(self.engine, self.config, "controller", "key_up", True),
 
485
        KeyConfigChoice(self.engine, self.config, "controller", "key_down", True),
 
486
        KeyConfigChoice(self.engine, self.config, "controller", "key_cancel"),
 
487
        KeyConfigChoice(self.engine, self.config, "controller", "key_start"),
 
488
        KeyConfigChoice(self.engine, self.config, "controller", "key_star", True),
 
489
        KeyConfigChoice(self.engine, self.config, "controller", "key_kill"),
 
490
        ConfigChoice(   self.engine, self.config, "controller", "analog_kill", autoApply = True),
 
491
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp", autoApply = True),
 
492
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp_threshold", autoApply = True),
 
493
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp_sensitivity", autoApply = True),
 
494
        #ConfigChoice(   self.engine, self.config, "controller", "analog_fx", autoApply = True),
 
495
        (_("Rename Controller"), self.renameController),
 
496
      ]
 
497
    elif type == 2:
 
498
      self.config.set("controller", "key_5", None)
 
499
      self.config.set("controller", "key_5a", None)
 
500
      self.config.set("controller", "key_kill", None)
 
501
        
 
502
      controlKeys = [
 
503
        ActiveConfigChoice(self.engine, self.config, "controller", "type", self.changeType),
 
504
        KeyConfigChoice(self.engine, self.config, "controller", "key_2"),
 
505
        KeyConfigChoice(self.engine, self.config, "controller", "key_2a", True),
 
506
        KeyConfigChoice(self.engine, self.config, "controller", "key_3"),
 
507
        KeyConfigChoice(self.engine, self.config, "controller", "key_3a", True),
 
508
        KeyConfigChoice(self.engine, self.config, "controller", "key_4"),
 
509
        KeyConfigChoice(self.engine, self.config, "controller", "key_4a", True),
 
510
        KeyConfigChoice(self.engine, self.config, "controller", "key_1"),
 
511
        KeyConfigChoice(self.engine, self.config, "controller", "key_1a", True),
 
512
        KeyConfigChoice(self.engine, self.config, "controller", "key_action1"),
 
513
        KeyConfigChoice(self.engine, self.config, "controller", "key_action2", True),
 
514
        KeyConfigChoice(self.engine, self.config, "controller", "key_left", True),
 
515
        KeyConfigChoice(self.engine, self.config, "controller", "key_right", True),
 
516
        KeyConfigChoice(self.engine, self.config, "controller", "key_up", True),
 
517
        KeyConfigChoice(self.engine, self.config, "controller", "key_down", True),
 
518
        KeyConfigChoice(self.engine, self.config, "controller", "key_cancel"),
 
519
        KeyConfigChoice(self.engine, self.config, "controller", "key_start"),
 
520
        KeyConfigChoice(self.engine, self.config, "controller", "key_star", True),
 
521
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp", autoApply = True),
 
522
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp_threshold", autoApply = True),
 
523
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp_sensitivity", autoApply = True),
 
524
        #ConfigChoice(   self.engine, self.config, "controller", "analog_drum", autoApply = True),
 
525
        (_("Rename Controller"), self.renameController),
 
526
      ]
 
527
    elif type == 3:
 
528
      self.config.set("controller", "key_kill", None)
 
529
      controlKeys = [
 
530
        ActiveConfigChoice(self.engine, self.config, "controller", "type", self.changeType),
 
531
        KeyConfigChoice(self.engine, self.config, "controller", "key_2"),
 
532
        KeyConfigChoice(self.engine, self.config, "controller", "key_2a", True),
 
533
        KeyConfigChoice(self.engine, self.config, "controller", "key_3"),
 
534
        KeyConfigChoice(self.engine, self.config, "controller", "key_3a", True),
 
535
        KeyConfigChoice(self.engine, self.config, "controller", "key_4"),
 
536
        KeyConfigChoice(self.engine, self.config, "controller", "key_4a", True),
 
537
        KeyConfigChoice(self.engine, self.config, "controller", "key_5"),
 
538
        KeyConfigChoice(self.engine, self.config, "controller", "key_5a", True),
 
539
        KeyConfigChoice(self.engine, self.config, "controller", "key_1"),
 
540
        KeyConfigChoice(self.engine, self.config, "controller", "key_1a", True),
 
541
        KeyConfigChoice(self.engine, self.config, "controller", "key_action1"),
 
542
        KeyConfigChoice(self.engine, self.config, "controller", "key_action2", True),
 
543
        KeyConfigChoice(self.engine, self.config, "controller", "key_left", True),
 
544
        KeyConfigChoice(self.engine, self.config, "controller", "key_right", True),
 
545
        KeyConfigChoice(self.engine, self.config, "controller", "key_up", True),
 
546
        KeyConfigChoice(self.engine, self.config, "controller", "key_down", True),
 
547
        KeyConfigChoice(self.engine, self.config, "controller", "key_cancel"),
 
548
        KeyConfigChoice(self.engine, self.config, "controller", "key_start"),
 
549
        KeyConfigChoice(self.engine, self.config, "controller", "key_star", True),
 
550
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp", autoApply = True),
 
551
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp_threshold", autoApply = True),
 
552
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp_sensitivity", autoApply = True),
 
553
        #ConfigChoice(   self.engine, self.config, "controller", "analog_drum", autoApply = True),
 
554
        (_("Rename Controller"), self.renameController),
 
555
      ]
 
556
    elif type == 4:
 
557
      self.config.set("controller", "key_2a", None)
 
558
      self.config.set("controller", "key_3a", None)
 
559
      self.config.set("controller", "key_4a", None)
 
560
      self.config.set("controller", "key_5a", None)
 
561
      if str(self.config.get("controller", "key_5")) == "None":
 
562
        self.config.set("controller", "key_5", self.config.getDefault("controller", "key_5"))
 
563
      if str(self.config.get("controller", "key_1a")) == "None":
 
564
        self.config.set("controller", "key_1a", self.config.getDefault("controller", "key_1a"))
 
565
      if str(self.config.get("controller", "key_kill")) == "None":
 
566
        self.config.set("controller", "key_kill", self.config.getDefault("controller", "key_kill"))
 
567
      
 
568
      controlKeys = [
 
569
        ActiveConfigChoice(self.engine, self.config, "controller", "type", self.changeType),
 
570
        KeyConfigChoice(self.engine, self.config, "controller", "key_action1"),
 
571
        KeyConfigChoice(self.engine, self.config, "controller", "key_action2"),
 
572
        KeyConfigChoice(self.engine, self.config, "controller", "key_1"),
 
573
        KeyConfigChoice(self.engine, self.config, "controller", "key_2"),
 
574
        KeyConfigChoice(self.engine, self.config, "controller", "key_3"),
 
575
        KeyConfigChoice(self.engine, self.config, "controller", "key_4"),
 
576
        KeyConfigChoice(self.engine, self.config, "controller", "key_5"),
 
577
        KeyConfigChoice(self.engine, self.config, "controller", "key_1a", shift = _("Press the highest fret on the slider. Hold Escape to cancel.")),
 
578
        KeyConfigChoice(self.engine, self.config, "controller", "key_left", True),
 
579
        KeyConfigChoice(self.engine, self.config, "controller", "key_right", True),
 
580
        KeyConfigChoice(self.engine, self.config, "controller", "key_up", True),
 
581
        KeyConfigChoice(self.engine, self.config, "controller", "key_down", True),
 
582
        KeyConfigChoice(self.engine, self.config, "controller", "key_cancel"),
 
583
        KeyConfigChoice(self.engine, self.config, "controller", "key_start"),
 
584
        KeyConfigChoice(self.engine, self.config, "controller", "key_star"),
 
585
        KeyConfigChoice(self.engine, self.config, "controller", "key_kill"),
 
586
        ConfigChoice(   self.engine, self.config, "controller", "analog_kill", autoApply = True),
 
587
        ConfigChoice(   self.engine, self.config, "controller", "analog_slide", autoApply = True),
 
588
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp", autoApply = True),
 
589
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp_threshold", autoApply = True),
 
590
        ConfigChoice(   self.engine, self.config, "controller", "analog_sp_sensitivity", autoApply = True),
 
591
        #ConfigChoice(   self.engine, self.config, "controller", "analog_fx", autoApply = True),
 
592
        (_("Rename Controller"), self.renameController),
 
593
      ]
 
594
    elif type == 5:
 
595
      self.config.set("controller", "key_1", None)
 
596
      self.config.set("controller", "key_2", None)
 
597
      self.config.set("controller", "key_3", None)
 
598
      self.config.set("controller", "key_4", None)
 
599
      self.config.set("controller", "key_5", None)
 
600
      self.config.set("controller", "key_1a", None)
 
601
      self.config.set("controller", "key_2a", None)
 
602
      self.config.set("controller", "key_3a", None)
 
603
      self.config.set("controller", "key_4a", None)
 
604
      self.config.set("controller", "key_5a", None)
 
605
      self.config.set("controller", "key_kill", None)
 
606
      self.config.set("controller", "key_star", None)
 
607
      self.config.set("controller", "key_action1", None)
 
608
      self.config.set("controller", "key_action2", None)
 
609
      controlKeys = [
 
610
        ActiveConfigChoice(self.engine, self.config, "controller", "type", self.changeType),
 
611
        ConfigChoice(   self.engine, self.config, "controller", "mic_device", autoApply = True),
 
612
        KeyConfigChoice(self.engine, self.config, "controller", "key_left", True),
 
613
        KeyConfigChoice(self.engine, self.config, "controller", "key_right", True),
 
614
        KeyConfigChoice(self.engine, self.config, "controller", "key_up", True),
 
615
        KeyConfigChoice(self.engine, self.config, "controller", "key_down", True),
 
616
        KeyConfigChoice(self.engine, self.config, "controller", "key_cancel"),
 
617
        KeyConfigChoice(self.engine, self.config, "controller", "key_start"),
 
618
        ConfigChoice(   self.engine, self.config, "controller", "mic_tap_sensitivity", autoApply = True),
 
619
        ConfigChoice(   self.engine, self.config, "controller", "mic_passthrough_volume", autoApply = True),
 
620
        (_("Rename Controller"), self.renameController),
 
621
      ]
 
622
    self.menu = Menu.Menu(self.engine, controlKeys, onCancel = self.cancel)
 
623
    self.engine.view.pushLayer(self.menu)
 
624
  
 
625
  def changeType(self):
 
626
    self.engine.view.popLayer(self.menu)
 
627
    self.setupMenu()
 
628
  
 
629
  def renameController(self):
 
630
    newControl = ""
 
631
    while newControl.strip().lower() in self.badname or newControl.strip() == "":
 
632
      newControl = Dialogs.getText(self.engine, _("Please rename your controller"), self.control)
 
633
      if newControl.strip().lower() in self.badname and not newControl.strip() == self.control:
 
634
        Dialogs.showMessage(self.engine, _("That name is already taken."))
 
635
      elif newControl.strip() == "" or newControl.strip() == self.control:
 
636
        Dialogs.showMessage(self.engine, _("Canceled."))
 
637
        break
 
638
    else:
 
639
      Player.renameControl(self.control, newControl)
 
640
      self.control = newControl
 
641
      self.engine.view.popLayer(self.menu)
 
642
      self.setupMenu()
 
643
  
 
644
  def run(self, ticks):
 
645
    self.time += ticks/50.0
 
646
    
 
647
  def render(self, visibility, topMost):
 
648
    pass
 
649
 
 
650
 
 
651
class SettingsMenu(Menu.Menu):
 
652
  def __init__(self, engine):
 
653
 
 
654
    self.engine = engine
 
655
    self.logClassInits = self.engine.config.get("game", "log_class_inits")
 
656
    if self.logClassInits == 1:
 
657
      Log.debug("SettingsMenu class init (Settings.py)...")
 
658
    
 
659
    self.keyCheckerMode = Config.get("game", "key_checker_mode")
 
660
    
 
661
    self.opt_text_x = Theme.opt_text_xPos
 
662
    self.opt_text_y = Theme.opt_text_yPos
 
663
 
 
664
    if engine.data.theme == 0:
 
665
      if self.opt_text_x == None:
 
666
        self.opt_text_x = .44
 
667
      if self.opt_text_y == None:
 
668
        self.opt_text_y = .14
 
669
    elif engine.data.theme == 1:
 
670
      if self.opt_text_x == None:
 
671
        self.opt_text_x = .38
 
672
      if self.opt_text_y == None:
 
673
        self.opt_text_y = .15
 
674
    elif engine.data.theme == 2:
 
675
      if self.opt_text_x == None:
 
676
        self.opt_text_x = .25
 
677
      if self.opt_text_y == None:
 
678
        self.opt_text_y = .14
 
679
 
 
680
 
 
681
    self.opt_text_color = Theme.hexToColor(Theme.opt_text_colorVar)
 
682
    self.opt_selected_color = Theme.hexToColor(Theme.opt_selected_colorVar)
 
683
 
 
684
    Log.debug("Option text / selected hex colors: " + Theme.opt_text_colorVar + " / " + Theme.opt_selected_colorVar)
 
685
 
 
686
 
 
687
    if self.opt_text_color == None:
 
688
      self.opt_text_color = (1,1,1)
 
689
    if self.opt_selected_color == None:
 
690
      self.opt_selected_color = (1,0.75,0)
 
691
 
 
692
    Log.debug("Option text / selected colors: " + str(self.opt_text_color) + " / " + str(self.opt_selected_color))
 
693
 
 
694
    self.modSettings = [
 
695
      ConfigChoice(engine, engine.config, "mods",  "mod_" + m) for m in Mod.getAvailableMods(engine)
 
696
    ]
 
697
    if len(self.modSettings) > 0:
 
698
      self.modSettingsMenu = Menu.Menu(self.engine, self.modSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
699
    else:
 
700
      self.modSettingsMenu = self.modSettings
 
701
    
 
702
    self.stagesOptions = [
 
703
      ConfigChoice(self.engine, self.engine.config, "game", "stage_mode", autoApply = True),   #myfingershurt
 
704
      ConfigChoice(self.engine, self.engine.config, "game", "animated_stage_folder", autoApply = True),   #myfingershurt
 
705
      ConfigChoice(self.engine, self.engine.config, "game", "song_stage", autoApply = True),   #myfingershurt
 
706
      ConfigChoice(self.engine, self.engine.config, "game", "rotate_stages", autoApply = True),   #myfingershurt
 
707
      ConfigChoice(self.engine, self.engine.config, "game", "stage_rotate_delay", autoApply = True),   #myfingershurt - user defined stage rotate delay
 
708
      ConfigChoice(self.engine, self.engine.config, "game", "stage_animate", autoApply = True),   #myfingershurt - user defined stage rotate delay
 
709
      ConfigChoice(self.engine, self.engine.config, "game", "stage_animate_delay", autoApply = True),   #myfingershurt - user defined stage rotate delay
 
710
      ConfigChoice(self.engine, self.engine.config, "game", "miss_pauses_anim", autoApply = True),
 
711
    ]
 
712
    self.stagesOptionsMenu = Menu.Menu(self.engine, self.stagesOptions, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
713
    
 
714
    self.hopoSettings = [
 
715
       ConfigChoice(self.engine, self.engine.config, "game", "hopo_system", autoApply = True),      #myfingershurt
 
716
       ConfigChoice(self.engine, self.engine.config, "game", "song_hopo_freq", autoApply = True),      #myfingershurt
 
717
       ConfigChoice(self.engine, self.engine.config, "game", "hopo_after_chord", autoApply = True),      #myfingershurt
 
718
    ]
 
719
    self.hopoSettingsMenu = Menu.Menu(self.engine, self.hopoSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
720
    
 
721
    self.lyricsSettings = [
 
722
       ConfigChoice(self.engine, self.engine.config, "game", "midi_lyric_mode", autoApply = True, isQuickset = 1),      #myfingershurt
 
723
       ConfigChoice(self.engine, self.engine.config, "game", "vocal_scroll", autoApply = True, isQuickset = 1),      #akedrou
 
724
       ConfigChoice(self.engine, self.engine.config, "game", "vocal_speed", autoApply = True, isQuickset = 1),      #akedrou
 
725
       ConfigChoice(self.engine, self.engine.config, "game", "rb_midi_lyrics", autoApply = True, isQuickset = 1),      #myfingershurt
 
726
       ConfigChoice(self.engine, self.engine.config, "game", "rb_midi_sections", autoApply = True, isQuickset = 1),      #myfingershurt
 
727
       ConfigChoice(self.engine, self.engine.config, "game", "lyric_mode", autoApply = True, isQuickset = 1),      #myfingershurt
 
728
       ConfigChoice(self.engine, self.engine.config, "game", "script_lyric_pos", autoApply = True),      #myfingershurt
 
729
    ]
 
730
    self.lyricsSettingsMenu = Menu.Menu(self.engine, self.lyricsSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
731
    
 
732
    jurgenSettings = self.refreshJurgenSettings(init = True)
 
733
    self.jurgenSettingsMenu = Menu.Menu(self.engine, jurgenSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
734
           
 
735
    self.advancedGameSettings = [
 
736
      ConfigChoice(self.engine, self.engine.config, "performance", "star_score_updates", autoApply = True, isQuickset = 1),   #MFH
 
737
      ConfigChoice(self.engine, self.engine.config, "game", "bass_groove_enable", autoApply = True, isQuickset = 2),#myfingershurt
 
738
      ConfigChoice(self.engine, self.engine.config, "game", "mark_solo_sections", autoApply = True),
 
739
      ConfigChoice(self.engine, self.engine.config, "game", "lphrases", autoApply = True),#blazingamer
 
740
      ConfigChoice(self.engine, self.engine.config, "game", "decimal_places", autoApply = True), #MFH
 
741
      ConfigChoice(self.engine, self.engine.config, "game", "ignore_open_strums", autoApply = True),      #myfingershurt
 
742
      ConfigChoice(self.engine, self.engine.config, "game", "big_rock_endings", autoApply = True, isQuickset = 2),#myfingershurt
 
743
      ConfigChoice(self.engine, self.engine.config, "game", "starpower_mode", autoApply = True),#myfingershurt
 
744
      ConfigChoice(self.engine, self.engine.config, "game", "party_time", autoApply = True),
 
745
      ConfigChoice(self.engine, self.engine.config, "game", "keep_play_count", autoApply = True),
 
746
      ConfigChoice(self.engine, self.engine.config, "game", "lost_focus_pause", autoApply = True),
 
747
    ]
 
748
    self.advancedGameSettingsMenu = Menu.Menu(self.engine, self.advancedGameSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
749
    
 
750
    self.battleObjectSettings = [
 
751
      ConfigChoice(engine, engine.config, "game", "battle_Whammy", autoApply = True),
 
752
      ConfigChoice(engine, engine.config, "game", "battle_Diff_Up", autoApply = True),
 
753
      ConfigChoice(engine, engine.config, "game", "battle_String_Break", autoApply = True),
 
754
      ConfigChoice(engine, engine.config, "game", "battle_Double", autoApply = True),
 
755
      ConfigChoice(engine, engine.config, "game", "battle_Death_Drain", autoApply = True),
 
756
      ConfigChoice(engine, engine.config, "game", "battle_Amp_Overload", autoApply = True),
 
757
      ConfigChoice(engine, engine.config, "game", "battle_Switch_Controls", autoApply = True),
 
758
      ConfigChoice(engine, engine.config, "game", "battle_Steal", autoApply = True),
 
759
      ConfigChoice(engine, engine.config, "game", "battle_Tune", autoApply = True),
 
760
    ]
 
761
    
 
762
    self.battleObjectSettingsMenu = Menu.Menu(self.engine, self.battleObjectSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
763
    
 
764
    self.battleSettings = [
 
765
      (_("Battle Objects"), self.battleObjectSettingsMenu, _("Set which objects can appear in Battle Mode")),
 
766
    ]
 
767
    
 
768
    self.battleSettingsMenu = Menu.Menu(self.engine, self.battleSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
769
    
 
770
    self.basicSettings = [
 
771
      ConfigChoice(self.engine, self.engine.config, "game",  "language"),
 
772
      ConfigChoice(self.engine, self.engine.config, "game", "T_sound", autoApply = True), #Faaa Drum sound
 
773
      ConfigChoice(self.engine, self.engine.config, "game", "star_scoring", autoApply = True),#myfingershurt
 
774
      ConfigChoice(self.engine, self.engine.config, "game", "career_star_min", autoApply = True), #akedrou
 
775
      ConfigChoice(self.engine, self.engine.config, "game", "resume_countdown", autoApply = True), #akedrou
 
776
      ConfigChoice(self.engine, self.engine.config, "game", "sp_notes_while_active", autoApply = True, isQuickset = 2),   #myfingershurt - setting for gaining more SP while active
 
777
      ConfigChoice(self.engine, self.engine.config, "game", "drum_sp_mode", autoApply = True),#myfingershurt
 
778
      ConfigChoice(self.engine, self.engine.config, "game",  "uploadscores", autoApply = True),
 
779
      ConfigChoice(self.engine, self.engine.config, "audio",  "delay", autoApply = True),     #myfingershurt: so a/v delay can be set without restarting FoF
 
780
      (_("Advanced Gameplay Settings"), self.advancedGameSettingsMenu, _("Set advanced gameplay settings that affect the game rules.")),
 
781
      (_("Vocal Mode Settings"), self.lyricsSettingsMenu, _("Change settings that affect lyrics and in-game vocals.")),
 
782
      (_("HO/PO Settings"), self.hopoSettingsMenu, _("Change settings that affect hammer-ons and pull-offs (HO/PO).")),
 
783
      (_("Battle Settings"), self.battleSettingsMenu, _("Change settings that affect battle mode.")),
 
784
    ]
 
785
 
 
786
    self.basicSettingsMenu = Menu.Menu(self.engine, self.basicSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
787
 
 
788
    self.keyChangeSettings = [
 
789
      (_("Test Controller 1"), lambda: self.keyTest(0), _("Test the controller configured for slot 1.")),
 
790
      (_("Test Controller 2"), lambda: self.keyTest(1), _("Test the controller configured for slot 2.")),
 
791
      (_("Test Controller 3"), lambda: self.keyTest(2), _("Test the controller configured for slot 3.")),
 
792
      (_("Test Controller 4"), lambda: self.keyTest(3), _("Test the controller configured for slot 4.")),
 
793
    ]
 
794
    self.keyChangeMenu = Menu.Menu(self.engine, self.keyChangeSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
795
 
 
796
    self.keySettings = self.refreshKeySettings(init = True)
 
797
    self.keySettingsMenu = Menu.Menu(self.engine, self.keySettings, onClose = self.controlCheck, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
798
    
 
799
    self.neckTransparency = [      #volshebnyi
 
800
      ConfigChoice(self.engine, self.engine.config, "game", "necks_alpha", autoApply = True),
 
801
      ConfigChoice(self.engine, self.engine.config, "game", "neck_alpha", autoApply = True),
 
802
      ConfigChoice(self.engine, self.engine.config, "game", "solo_neck_alpha", autoApply = True),
 
803
      ConfigChoice(self.engine, self.engine.config, "game", "bg_neck_alpha", autoApply = True),
 
804
      ConfigChoice(self.engine, self.engine.config, "game", "fail_neck_alpha", autoApply = True), 
 
805
      ConfigChoice(self.engine, self.engine.config, "game", "overlay_neck_alpha", autoApply = True),  
 
806
    ]
 
807
    self.neckTransparencyMenu = Menu.Menu(self.engine, self.neckTransparency, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
808
              
 
809
    self.shaderSettings = [      #volshebnyi
 
810
      ConfigChoice(self.engine, self.engine.config, "video", "shader_use", autoApply = True), 
 
811
      ConfigChoice(self.engine, self.engine.config, "video", "shader_neck", autoApply = True),
 
812
      ConfigChoice(self.engine, self.engine.config, "video", "shader_stage", autoApply = True),
 
813
      ConfigChoice(self.engine, self.engine.config, "video", "shader_sololight", autoApply = True),
 
814
      ConfigChoice(self.engine, self.engine.config, "video", "shader_tail", autoApply = True),
 
815
      ConfigChoice(self.engine, self.engine.config, "video", "shader_notes", autoApply = True),
 
816
      ConfigChoice(self.engine, self.engine.config, "video", "shader_cd", autoApply = True),
 
817
    ]
 
818
    self.shaderSettings = Menu.Menu(self.engine, self.shaderSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
819
    
 
820
    self.advancedVideoSettings = [
 
821
      ConfigChoice(self.engine, self.engine.config, "engine", "highpriority", isQuickset = 1),
 
822
      ConfigChoice(self.engine, self.engine.config, "video",  "fps", isQuickset = 1),
 
823
      ConfigChoice(self.engine, self.engine.config, "game", "accuracy_pos", autoApply = True),
 
824
      ConfigChoice(self.engine, self.engine.config, "game", "gsolo_acc_pos", autoApply = True, isQuickset = 1), #MFH
 
825
      ConfigChoice(self.engine, self.engine.config, "coffee", "noterotate", autoApply = True), #blazingamer
 
826
      ConfigChoice(self.engine, self.engine.config, "game", "gfx_version_tag", autoApply = True), #MFH
 
827
      ConfigChoice(self.engine, self.engine.config, "video",  "multisamples", isQuickset = 1),
 
828
      ConfigChoice(self.engine, self.engine.config, "game", "in_game_font_shadowing", autoApply = True),      #myfingershurt
 
829
      ConfigChoice(self.engine, self.engine.config, "performance", "static_strings", autoApply = True, isQuickset = 1),      #myfingershurt
 
830
      ConfigChoice(self.engine, self.engine.config, "performance", "killfx", autoApply = True, isQuickset = 1),   #blazingamer
 
831
      (_("More Effects"), self.shaderSettings, _("Change the settings of the shader system.")), #volshebnyi
 
832
    ]
 
833
    self.advancedVideoSettingsMenu = Menu.Menu(self.engine, self.advancedVideoSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
834
    
 
835
    self.fretSettings = [
 
836
      ConfigChoice(self.engine, self.engine.config, "fretboard", "point_of_view", autoApply = True, isQuickset = 2),
 
837
      ConfigChoice(self.engine, self.engine.config, "game", "notedisappear", autoApply = True),
 
838
      ConfigChoice(self.engine, self.engine.config, "game", "frets_under_notes", autoApply = True), #MFH
 
839
      ConfigChoice(self.engine, self.engine.config, "game", "nstype", autoApply = True),      #blazingamer
 
840
      ConfigChoice(self.engine, self.engine.config, "coffee", "neckSpeed", autoApply = True),
 
841
      ConfigChoice(self.engine, self.engine.config, "game", "large_drum_neck", autoApply = True),      #myfingershurt
 
842
      ConfigChoice(self.engine, self.engine.config, "game", "bass_groove_neck", autoApply = True),      #myfingershurt
 
843
      ConfigChoice(self.engine, self.engine.config, "game", "guitar_solo_neck", autoApply = True),      #myfingershurt
 
844
      ConfigChoice(self.engine, self.engine.config, "fretboard", "ovrneckoverlay", autoApply = True),
 
845
      ConfigChoice(self.engine, self.engine.config, "game", "incoming_neck_mode", autoApply = True, isQuickset = 1),
 
846
      #myfingershurt 
 
847
      (_("Change Neck Transparency"), self.neckTransparencyMenu, _("Change the transparency of the various in-game necks.")), #volshebnyi
 
848
    ]
 
849
    self.fretSettingsMenu = Menu.Menu(self.engine, self.fretSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
850
 
 
851
    self.themeDisplaySettings = [
 
852
      ConfigChoice(self.engine, self.engine.config, "game", "rb_sp_neck_glow", autoApply = True),
 
853
      ConfigChoice(self.engine, self.engine.config, "game",   "small_rb_mult", autoApply = True), #blazingamer
 
854
      ConfigChoice(self.engine, self.engine.config, "game", "starfx", autoApply = True),
 
855
      ConfigChoice(self.engine, self.engine.config, "performance", "starspin", autoApply = True, isQuickset = 1),
 
856
    ]
 
857
    self.themeDisplayMenu = Menu.Menu(self.engine, self.themeDisplaySettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
858
    
 
859
    self.inGameDisplaySettings = [
 
860
      (_("Theme Display Settings"), self.themeDisplayMenu, _("Change settings that only affect certain theme types.")),
 
861
      ConfigChoice(self.engine, self.engine.config, "game", "in_game_stars", autoApply = True, isQuickset = 2),#myfingershurt
 
862
      ConfigChoice(self.engine, self.engine.config, "game", "partial_stars", autoApply = True, isQuickset = 1),#myfingershurt
 
863
      ConfigChoice(self.engine, self.engine.config, "performance", "star_continuous_fillup", autoApply = True, isQuickset = 1), #stump
 
864
      ConfigChoice(self.engine, self.engine.config, "coffee", "game_phrases", autoApply = True, isQuickset = 1),
 
865
      ConfigChoice(self.engine, self.engine.config, "game", "hopo_indicator", autoApply = True),
 
866
      ConfigChoice(self.engine, self.engine.config, "game", "accuracy_mode", autoApply = True),
 
867
      ConfigChoice(self.engine, self.engine.config, "performance", "in_game_stats", autoApply = True, isQuickset = 1),#myfingershurt
 
868
      ConfigChoice(self.engine, self.engine.config, "game", "gsolo_accuracy_disp", autoApply = True, isQuickset = 1), #MFH
 
869
      ConfigChoice(self.engine, self.engine.config, "game", "solo_frame", autoApply = True),      #myfingershurt
 
870
      ConfigChoice(self.engine, self.engine.config, "video", "disable_fretsfx", autoApply = True),
 
871
      ConfigChoice(self.engine, self.engine.config, "video", "hitglow_color", autoApply = True),
 
872
      ConfigChoice(self.engine, self.engine.config, "game", "game_time", autoApply = True),  
 
873
      ConfigChoice(self.engine, self.engine.config, "video", "counting", autoApply = True, isQuickset = 2),
 
874
    ]
 
875
    self.inGameDisplayMenu = Menu.Menu(self.engine, self.inGameDisplaySettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
876
      
 
877
    modes = self.engine.video.getVideoModes()
 
878
    modes.reverse()
 
879
    Config.define("video",  "resolution", str,   "1024x768", text = _("Video Resolution"), options = ["%dx%d" % (m[0], m[1]) for m in modes], tipText = _("Set the resolution of the game. In windowed mode, higher values mean a larger screen."))
 
880
    self.videoSettings = [
 
881
      ConfigChoice(engine, engine.config, "coffee", "themename"), #was autoapply... why?
 
882
      ConfigChoice(engine, engine.config, "video",  "resolution"),
 
883
      ConfigChoice(engine, engine.config, "video",  "fullscreen"),
 
884
      ConfigChoice(engine, engine.config, "game", "use_graphical_submenu", autoApply = True, isQuickset = 1),
 
885
      (_("Stages Options"), self.stagesOptionsMenu, _("Change settings related to the in-game background.")),
 
886
      (_("Choose Default Neck >"), lambda: Dialogs.chooseNeck(self.engine), _("Choose your default neck. You still have to choose which neck you use for your character in the character select screen.")),
 
887
      (_("Fretboard Settings"), self.fretSettingsMenu, _("Change settings related to the fretboard.")),
 
888
      (_("In-Game Display Settings"), self.inGameDisplayMenu, _("Change what and where things appear in-game.")),
 
889
      (_("Advanced Video Settings"), self.advancedVideoSettingsMenu, _("Change advanced video settings.")),
 
890
    ]
 
891
    self.videoSettingsMenu = Menu.Menu(self.engine, self.videoSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
892
 
 
893
    
 
894
    self.volumeSettings = [
 
895
      VolumeConfigChoice(engine, engine.config, "audio",  "guitarvol", autoApply = True),
 
896
      VolumeConfigChoice(engine, engine.config, "audio",  "songvol", autoApply = True),
 
897
      VolumeConfigChoice(engine, engine.config, "audio",  "screwupvol", autoApply = True),
 
898
      VolumeConfigChoice(engine, engine.config, "audio",  "miss_volume", autoApply = True),
 
899
      VolumeConfigChoice(engine, engine.config, "audio",  "single_track_miss_volume", autoApply = True),
 
900
      VolumeConfigChoice(engine, engine.config, "audio",  "crowd_volume", autoApply = True), #akedrou
 
901
      VolumeConfigChoice(engine, engine.config, "audio",  "kill_volume", autoApply = True), #MFH
 
902
      ActiveConfigChoice(engine, engine.config, "audio",  "SFX_volume", autoApply = True, onChange = self.engine.data.SetAllSoundFxObjectVolumes, volume = True), #MFH
 
903
      ActiveConfigChoice(engine, engine.config, "audio",  "menu_volume", autoApply = True, onChange = self.engine.mainMenu.setMenuVolume),
 
904
    ]
 
905
    self.volumeSettingsMenu = Menu.Menu(engine, self.volumeSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
906
    
 
907
    self.advancedAudioSettings = [
 
908
       ConfigChoice(engine, engine.config, "audio",  "frequency"),
 
909
       ConfigChoice(engine, engine.config, "audio",  "bits"),
 
910
       ConfigChoice(engine, engine.config, "audio",  "buffersize"),
 
911
       ConfigChoice(engine, engine.config, "game", "result_cheer_loop", autoApply = True), #MFH
 
912
       ConfigChoice(engine, engine.config, "game", "cheer_loop_delay", autoApply = True), #MFH
 
913
    ]
 
914
    self.advancedAudioSettingsMenu = Menu.Menu(engine, self.advancedAudioSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
915
 
 
916
    self.audioSettings = [
 
917
      (_("Volume Settings"),    self.volumeSettingsMenu, _("Change the volume of game sounds.")),
 
918
      ConfigChoice(engine, engine.config, "game", "sustain_muting", autoApply = True),   #myfingershurt
 
919
      ConfigChoice(engine, engine.config, "game", "mute_drum_fill", autoApply = True),
 
920
      ConfigChoice(engine, engine.config, "audio", "mute_last_second", autoApply = True), #MFH
 
921
      ConfigChoice(engine, engine.config, "game", "bass_kick_sound", autoApply = True),   #myfingershurt
 
922
      ConfigChoice(engine, engine.config, "game", "star_claps", autoApply = True),      #myfingershurt
 
923
      ConfigChoice(engine, engine.config, "game", "beat_claps", autoApply = True), #racer
 
924
      ConfigChoice(engine, engine.config, "audio",  "whammy_effect", autoApply = True),     #MFH
 
925
      ConfigChoice(engine, engine.config, "audio", "enable_crowd_tracks", autoApply = True), 
 
926
      (_("Advanced Audio Settings"), self.advancedAudioSettingsMenu, _("Change advanced audio settings.")),
 
927
    ]
 
928
    self.audioSettingsMenu = Menu.Menu(engine, self.audioSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
929
    
 
930
    #MFH - new menu
 
931
    self.logfileSettings = [
 
932
      ConfigChoice(engine, engine.config, "game", "log_ini_reads", autoApply = True),#myfingershurt
 
933
      ConfigChoice(engine, engine.config, "game", "log_class_inits", autoApply = True),#myfingershurt
 
934
      ConfigChoice(engine, engine.config, "game", "log_loadings", autoApply = True),#myfingershurt
 
935
      ConfigChoice(engine, engine.config, "game", "log_sections", autoApply = True),#myfingershurt
 
936
      ConfigChoice(engine, engine.config, "game", "log_undefined_gets", autoApply = True),#myfingershurt
 
937
      ConfigChoice(engine, engine.config, "game", "log_marker_notes", autoApply = True),#myfingershurt
 
938
      ConfigChoice(engine, engine.config, "game", "log_starpower_misses", autoApply = True),#myfingershurt
 
939
      ConfigChoice(engine, engine.config, "log",   "log_unedited_midis", autoApply = True),#myfingershurt
 
940
      ConfigChoice(engine, engine.config, "log",   "log_lyric_events", autoApply = True),#myfingershurt
 
941
      ConfigChoice(engine, engine.config, "log",   "log_tempo_events", autoApply = True),#myfingershurt
 
942
    ]
 
943
    self.logfileSettingsMenu = Menu.Menu(engine, self.logfileSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
944
 
 
945
    self.debugSettings = [
 
946
      ConfigChoice(engine, engine.config, "video", "show_fps"),#evilynux
 
947
      ConfigChoice(engine, engine.config, "game", "kill_debug", autoApply = True),#myfingershurt
 
948
      ConfigChoice(engine, engine.config, "game", "hopo_debug_disp", autoApply = True),#myfingershurt
 
949
      ConfigChoice(engine, engine.config, "game", "show_unused_text_events", autoApply = True),#myfingershurt
 
950
      ConfigChoice(engine, engine.config, "debug",   "use_unedited_midis", autoApply = True),#myfingershurt
 
951
      #ConfigChoice(engine.config, "game", "font_rendering_mode", autoApply = True),#myfingershurt
 
952
      ConfigChoice(engine, engine.config, "debug", "show_raw_vocal_data", autoApply = True), #akedrou
 
953
      ConfigChoice(engine, engine.config, "debug",   "show_freestyle_active", autoApply = True),#myfingershurt
 
954
      ConfigChoice(engine, engine.config, "debug",   "show_bpm", autoApply = True),#myfingershurt
 
955
      ConfigChoice(engine, engine.config, "debug",   "use_new_vbpm_beta", autoApply = True),#myfingershurt
 
956
      ConfigChoice(engine, engine.config, "game", "use_new_pitch_analyzer", autoApply = True),  #stump
 
957
    ]
 
958
    self.debugSettingsMenu = Menu.Menu(engine, self.debugSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
959
    
 
960
    self.quickSettings = [
 
961
      ConfigChoice(engine, engine.config, "quickset", "performance", autoApply = True),
 
962
      ConfigChoice(engine, engine.config, "quickset", "gameplay", autoApply = True),
 
963
    ]
 
964
    self.quicksetMenu = Menu.Menu(engine, self.quickSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
965
 
 
966
    self.listSettings = [
 
967
      (_("Change Setlist Path >"), self.baseLibrarySelect, _("Set the path to a folder named 'songs' that contains your songs.")),
 
968
      ConfigChoice(engine, engine.config, "coffee", "song_display_mode", autoApply = True),
 
969
      ConfigChoice(engine, engine.config, "game",  "sort_order", autoApply = True),
 
970
      ConfigChoice(engine, engine.config, "game", "sort_direction", autoApply = True),
 
971
      ConfigChoice(engine, engine.config, "game", "song_listing_mode", autoApply = True, isQuickset = 2),
 
972
      ConfigChoice(engine, engine.config, "game", "quickplay_tiers", autoApply = True),  #myfingershurt
 
973
      ConfigChoice(engine, engine.config, "coffee", "songfilepath", autoApply = True),
 
974
      #(_("Select List All Folder >"), self.listAllFolderSelect), #- Not Working Yet - Qstick
 
975
      ConfigChoice(engine, engine.config, "game", "songcovertype", autoApply = True),
 
976
      ConfigChoice(engine, engine.config, "game", "songlistrotation", autoApply = True, isQuickset = 1),
 
977
      ConfigChoice(engine, engine.config, "performance", "disable_librotation", autoApply = True),
 
978
      ConfigChoice(engine, engine.config, "game", "song_icons", autoApply = True),
 
979
      ConfigChoice(engine, engine.config, "game", "preload_labels", autoApply = True),
 
980
      ConfigChoice(engine, engine.config, "audio", "disable_preview", autoApply = True),  #myfingershurt
 
981
      ConfigChoice(engine, engine.config, "game", "songlist_instrument", autoApply = True), #MFH
 
982
      ConfigChoice(engine, engine.config, "game", "songlist_difficulty", autoApply = True), #evilynux
 
983
      ConfigChoice(engine, engine.config, "game",  "whammy_changes_sort_order", autoApply = True), #stump
 
984
      ConfigChoice(engine, engine.config, "game", "songlist_extra_stats", autoApply = True), #evilynux
 
985
      ConfigChoice(engine, engine.config, "game", "HSMovement", autoApply = True), #racer
 
986
      ConfigChoice(engine, engine.config, "performance", "disable_libcount", autoApply = True, isQuickset = 1), 
 
987
      ConfigChoice(engine, engine.config, "performance", "cache_song_metadata", autoApply = True, isQuickset = 1), #stump
 
988
      ConfigChoice(engine, engine.config, "songlist",  "nil_show_next_score", autoApply = True), #MFH
 
989
    ]
 
990
    self.listSettingsMenu = Menu.Menu(engine, self.listSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
991
    
 
992
    
 
993
    advancedSettings = [
 
994
      ConfigChoice(engine, engine.config, "performance", "game_priority", autoApply = True, isQuickset = 1),
 
995
      ConfigChoice(engine, engine.config, "performance", "use_psyco"),
 
996
      (_("Debug Settings"), self.debugSettingsMenu, _("Settings for coders to debug. Probably not worth changing.")),
 
997
      (_("Log Settings"),    self.logfileSettingsMenu, _("Adds junk information to the logfile. Probably not useful in bug reports.")),
 
998
    ]
 
999
    self.advancedSettingsMenu = Menu.Menu(engine, advancedSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
1000
    
 
1001
    self.cheats = [
 
1002
      (_("AI Settings"), self.jurgenSettingsMenu, _("Change the settings of the AI")),
 
1003
      ConfigChoice(engine, engine.config, "game", "gh2_sloppy", autoApply = True),
 
1004
      ConfigChoice(engine, engine.config, "game", "whammy_saves_starpower", autoApply = True),#myfingershurt
 
1005
      ConfigChoice(self.engine, self.engine.config, "game",   "note_hit_window", autoApply = True), #alarian: defines hit window
 
1006
      ConfigChoice(engine, engine.config, "coffee", "hopo_frequency", autoApply = True),
 
1007
      ConfigChoice(engine, engine.config, "coffee", "failingEnabled", autoApply = True),
 
1008
      ConfigChoice(engine, engine.config, "audio",  "speed_factor", autoApply = True),     #MFH
 
1009
      ConfigChoice(engine, engine.config, "handicap",  "early_hit_window", autoApply = True),     #MFH
 
1010
      ConfigChoice(engine, engine.config, "handicap", "detailed_handicap", autoApply = True),
 
1011
      (_("Mod settings"), self.modSettingsMenu, _("Enable or disable any mods you have installed.")),
 
1012
    ]
 
1013
    self.cheatMenu = Menu.Menu(engine, self.cheats, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
1014
    
 
1015
    settings = [
 
1016
      (_("Gameplay Settings"),   self.basicSettingsMenu, _("Settings that affect the rules of the game.")),
 
1017
      (_("Control Settings"),     self.keySettingsMenu, _("Create, delete, and edit your controls.")),
 
1018
      (_("Display Settings"),     self.videoSettingsMenu, _("Theme, neck, resolution, etc.")),
 
1019
      (_("Audio Settings"),      self.audioSettingsMenu, _("Volume controls, etc.")),
 
1020
      (_("Setlist Settings"),   self.listSettingsMenu, _("Settings that affect the setlist.")),
 
1021
      (_("Advanced Settings"), self.advancedSettingsMenu, _("Settings that probably don't need to be changed.")),
 
1022
      (_("Mods, Cheats, AI"), self.cheatMenu, _("Set Jurgen to play for you, or other cheats.")),
 
1023
      (_("%s Credits") % (engine.versionString), lambda: Dialogs.showCredits(engine), _("See who made this game.")), # evilynux - Show Credits!
 
1024
      (_("Quickset"), self.quicksetMenu, _("A quick way to set many advanced settings.")),
 
1025
      (_("Hide Advanced Options"), self.advancedSettings)
 
1026
    ]
 
1027
  
 
1028
    self.settingsToApply = self.videoSettings + \
 
1029
                           self.advancedAudioSettings + \
 
1030
                           self.advancedVideoSettings + \
 
1031
                           self.basicSettings + \
 
1032
                           self.keySettings + \
 
1033
                           self.inGameDisplaySettings + \
 
1034
                           self.themeDisplaySettings + \
 
1035
                           self.debugSettings + \
 
1036
                           self.quickSettings + \
 
1037
                           self.modSettings
 
1038
 
 
1039
#-    self.settingsToApply = settings + \
 
1040
#-                           videoSettings + \
 
1041
#-                           AdvancedAudioSettings + \
 
1042
#-                           volumeSettings + \
 
1043
#-                           keySettings + \
 
1044
#-                           AdvancedVideoSettings + \
 
1045
#-                           FoFiXBasicSettings + \11/26/2008 11:10:30 PM
 
1046
#-                           perfSettings + \
 
1047
#-                           listSettings + \
 
1048
#-                           modSettings
 
1049
 
 
1050
    Menu.Menu.__init__(self, engine, settings, name = "advsettings", onCancel = self.applySettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)   #MFH - add position to this so we can move it
 
1051
 
 
1052
  def applySettings(self):
 
1053
    quickset(self.engine.config)
 
1054
    if self.engine.restartRequired or self.engine.quicksetRestart:
 
1055
      Dialogs.showMessage(self.engine, _("FoFiX needs to restart to apply setting changes."))
 
1056
      for option in self.settingsToApply:
 
1057
        if isinstance(option, ConfigChoice):
 
1058
          option.apply()
 
1059
      self.engine.restart()
 
1060
  
 
1061
  def refreshJurgenSettings(self, init = False):
 
1062
    choices = []
 
1063
    maxplayer = self.engine.config.get("performance", "max_players")
 
1064
    for i in range(maxplayer):
 
1065
      choices.append(ConfigChoice(self.engine, self.engine.config, "game", "jurg_p%d" % i, autoApply = True))
 
1066
      choices.append(ConfigChoice(self.engine, self.engine.config, "game", "jurg_skill_p%d" % i, autoApply = True))
 
1067
      choices.append(ConfigChoice(self.engine, self.engine.config, "game", "jurg_logic_p%d" % i, autoApply = True))
 
1068
    if init:
 
1069
      return choices
 
1070
    self.engine.mainMenu.settingsMenuObject.jurgenSettingsMenu.choices = choices
 
1071
  
 
1072
  def refreshKeySettings(self, init = False):
 
1073
    choices = [ #the reacharound
 
1074
      Menu.Choice(_("Test Controls"), self.keyChangeMenu, tipText = _("Go here to test your controllers.")),
 
1075
      ActiveConfigChoice(self.engine, self.engine.config, "game", "control0", onChange = self.engine.input.reloadControls),
 
1076
      ActiveConfigChoice(self.engine, self.engine.config, "game", "control1", onChange = self.engine.input.reloadControls),
 
1077
      ActiveConfigChoice(self.engine, self.engine.config, "game", "control2", onChange = self.engine.input.reloadControls),
 
1078
      ActiveConfigChoice(self.engine, self.engine.config, "game", "control3", onChange = self.engine.input.reloadControls),
 
1079
      Menu.Choice(_("New Controller"),    lambda: createControl(self.engine, refresh = self.refreshKeySettings), tipText = _("Create a new controller to use.")),
 
1080
      Menu.Choice(_("Edit Controller"),   lambda: chooseControl(self.engine, refresh = self.refreshKeySettings), tipText = _("Edit a controller you have created.")),
 
1081
      Menu.Choice(_("Delete Controller"), lambda: chooseControl(self.engine, "delete", refresh = self.refreshKeySettings), tipText = _("Delete a controller you have created.")),
 
1082
      ActiveConfigChoice(self.engine, self.engine.config, "performance", "max_players", onChange = self.refreshJurgenSettings), #akedrou
 
1083
      ActiveConfigChoice(self.engine, self.engine.config, "game", "scroll_delay", onChange = self.scrollSet),
 
1084
      ActiveConfigChoice(self.engine, self.engine.config, "game", "scroll_rate", onChange = self.scrollSet),
 
1085
      ActiveConfigChoice(self.engine, self.engine.config, "game", "p2_menu_nav", onChange = self.engine.input.reloadControls),#myfingershurt
 
1086
      ActiveConfigChoice(self.engine, self.engine.config, "game", "drum_navigation", onChange = self.engine.input.reloadControls),#myfingershurt
 
1087
      ActiveConfigChoice(self.engine, self.engine.config, "game", "key_checker_mode", onChange = self.engine.input.reloadControls),#myfingershurt
 
1088
    ]
 
1089
    if init:
 
1090
      return choices
 
1091
    self.engine.mainMenu.settingsMenuObject.keySettingsMenu.choices = choices
 
1092
  
 
1093
  def controlCheck(self):
 
1094
    control = [self.engine.config.get("game", "control0")]
 
1095
    self.keyCheckerMode = Config.get("game", "key_checker_mode")
 
1096
    if str(control[0]) == "None":
 
1097
      Dialogs.showMessage(self.engine, _("You must specify a controller for slot 1!"))
 
1098
      self.engine.view.pushLayer(self.keySettingsMenu)
 
1099
    else:
 
1100
      for i in range(1,4):
 
1101
        c = self.engine.config.get("game", "control%d" % i)
 
1102
        if c in control and str(c) != "None":
 
1103
          Dialogs.showMessage(self.engine, _("Controllers in slots %d and %d conflict. Setting %d to None.") % (control.index(c)+1, i+1, i+1))
 
1104
          self.engine.config.set("game", "control%d" % i, None)
 
1105
        else:
 
1106
          control.append(c)
 
1107
      self.engine.input.reloadControls()
 
1108
      if len(self.engine.input.controls.overlap) > 0 and self.keyCheckerMode > 0:
 
1109
        n = 0
 
1110
        for i in self.engine.input.controls.overlap:
 
1111
          if n > 2 and len(self.engine.input.controls.overlap) > 4:
 
1112
            Dialogs.showMessage(self.engine, _("%d more conflicts.") % (len(self.engine.input.controls.overlap)-3))
 
1113
            break
 
1114
          Dialogs.showMessage(self.engine, i)
 
1115
          n+= 1
 
1116
        if self.keyCheckerMode == 2:
 
1117
          self.engine.view.pushLayer(self.keySettingsMenu)
 
1118
      self.refreshKeySettings()
 
1119
  
 
1120
  def advancedSettings(self):
 
1121
    Config.set("game", "adv_settings", False)
 
1122
    self.engine.advSettings = False
 
1123
    if not self.engine.restartRequired:
 
1124
      self.engine.view.popLayer(self)
 
1125
      self.engine.input.removeKeyListener(self)
 
1126
    else:
 
1127
      self.applySettings()
 
1128
 
 
1129
  def keyTest(self, controller):
 
1130
    if str(self.engine.input.controls.controls[controller]) == "None":
 
1131
      Dialogs.showMessage(self.engine, "No controller set for slot %d" % (controller+1))
 
1132
    else:
 
1133
      Dialogs.testKeys(self.engine, controller)
 
1134
  
 
1135
  def scrollSet(self):
 
1136
    self.engine.scrollRate = self.engine.config.get("game", "scroll_rate")
 
1137
    self.engine.scrollDelay = self.engine.config.get("game", "scroll_delay")
 
1138
 
 
1139
  def resetLanguageToEnglish(self):
 
1140
    Log.debug("settings.resetLanguageToEnglish function call...")
 
1141
    if self.engine.config.get("game", "language") != "":
 
1142
      self.engine.config.set("game", "language", "")
 
1143
      self.engine.restart()
 
1144
 
 
1145
 
 
1146
  #def listAllFolderSelect(self):
 
1147
  #  Log.debug("settings.baseLibrarySelect function call...")
 
1148
  #  newPath = Dialogs.chooseFile(self.engine, masks = ["*/*"], prompt = _("Choose a New List All directory."), dirSelect = True)
 
1149
  #  if newPath != None:
 
1150
  #    Config.set("game", "listall_folder", os.path.dirname(newPath))
 
1151
  #    Log.debug(newPath)
 
1152
  #    Log.debug(os.path.dirname(newPath))
 
1153
  #    self.engine.resource.refreshBaseLib()   #myfingershurt - to let user continue with new songpath without restart
 
1154
      
 
1155
  def baseLibrarySelect(self):
 
1156
    Log.debug("settings.baseLibrarySelect function call...")
 
1157
    newPath = Dialogs.chooseFile(self.engine, masks = ["*/*"], prompt = _("Choose a new songs directory."), dirSelect = True)
 
1158
    if newPath != None:
 
1159
      Config.set("game", "base_library", os.path.dirname(newPath))
 
1160
      Config.set("game", "selected_library", os.path.basename(newPath))
 
1161
      Config.set("game", "selected_song", "")
 
1162
      self.engine.resource.refreshBaseLib()   #myfingershurt - to let user continue with new songpath without restart
 
1163
    
 
1164
 
 
1165
class BasicSettingsMenu(Menu.Menu):
 
1166
  def __init__(self, engine):
 
1167
 
 
1168
    self.engine = engine
 
1169
    self.keyActive = True
 
1170
    self.confirmNeck = False
 
1171
 
 
1172
    self.logClassInits = self.engine.config.get("game", "log_class_inits")
 
1173
    if self.logClassInits == 1:
 
1174
      Log.debug("BasicSettingsMenu class init (Settings.py)...")
 
1175
      
 
1176
    self.opt_text_x = Theme.opt_text_xPos
 
1177
    self.opt_text_y = Theme.opt_text_yPos
 
1178
 
 
1179
    if engine.data.theme == 0:
 
1180
      if self.opt_text_x == None:
 
1181
        self.opt_text_x = .44
 
1182
      if self.opt_text_y == None:
 
1183
        self.opt_text_y = .14
 
1184
    elif engine.data.theme == 1:
 
1185
      if self.opt_text_x == None:
 
1186
        self.opt_text_x = .38
 
1187
      if self.opt_text_y == None:
 
1188
        self.opt_text_y = .15
 
1189
    elif engine.data.theme == 2:
 
1190
      if self.opt_text_x == None:
 
1191
        self.opt_text_x = .25
 
1192
      if self.opt_text_y == None:
 
1193
        self.opt_text_y = .14
 
1194
 
 
1195
 
 
1196
    self.opt_text_color = Theme.hexToColor(Theme.opt_text_colorVar)
 
1197
    self.opt_selected_color = Theme.hexToColor(Theme.opt_selected_colorVar)
 
1198
 
 
1199
    Log.debug("Option text / selected hex colors: " + Theme.opt_text_colorVar + " / " + Theme.opt_selected_colorVar)
 
1200
 
 
1201
 
 
1202
    if self.opt_text_color == None:
 
1203
      self.opt_text_color = (1,1,1)
 
1204
    if self.opt_selected_color == None:
 
1205
      self.opt_selected_color = (1,0.75,0)
 
1206
 
 
1207
    Log.debug("Option text / selected colors: " + str(self.opt_text_color) + " / " + str(self.opt_selected_color))
 
1208
 
 
1209
    self.modSettings = [
 
1210
      ConfigChoice(engine, engine.config, "mods",  "mod_" + m) for m in Mod.getAvailableMods(engine)
 
1211
    ]
 
1212
    if len(self.modSettings) > 0:
 
1213
      self.modSettingsMenu = Menu.Menu(self.engine, self.modSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
1214
    else:
 
1215
      self.modSettingsMenu = self.modSettings
 
1216
    
 
1217
    FoFiXBasicSettings = [
 
1218
      ConfigChoice(engine, engine.config, "game",  "language"),
 
1219
      ConfigChoice(engine, engine.config, "game", "T_sound", autoApply = True), #Faaa Drum sound
 
1220
      ConfigChoice(engine, engine.config, "game", "star_scoring", autoApply = True),#myfingershurt
 
1221
      ConfigChoice(engine, engine.config, "game", "career_star_min", autoApply = True), #akedrou
 
1222
      ConfigChoice(engine, engine.config, "game", "resume_countdown", autoApply = True), #akedrou
 
1223
      ConfigChoice(engine, engine.config, "game", "sp_notes_while_active", autoApply = True, isQuickset = 2),   #myfingershurt - setting for gaining more SP while active
 
1224
      ConfigChoice(engine, engine.config, "game", "drum_sp_mode", autoApply = True),#myfingershurt
 
1225
      ConfigChoice(engine, engine.config, "game",  "uploadscores", autoApply = True),
 
1226
      ConfigChoice(engine, engine.config, "audio",  "delay", autoApply = True),     #myfingershurt: so a/v delay can be set without restarting FoF
 
1227
    ]
 
1228
    FoFiXBasicSettingsMenu = Menu.Menu(engine, FoFiXBasicSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
1229
    
 
1230
    self.keyChangeSettings = [
 
1231
      (_("Test Controller 1"), lambda: self.keyTest(0), _("Test the controller configured for slot 1.")),
 
1232
      (_("Test Controller 2"), lambda: self.keyTest(1), _("Test the controller configured for slot 2.")),
 
1233
      (_("Test Controller 3"), lambda: self.keyTest(2), _("Test the controller configured for slot 3.")),
 
1234
      (_("Test Controller 4"), lambda: self.keyTest(3), _("Test the controller configured for slot 4.")),
 
1235
    ]
 
1236
    self.keyChangeMenu = Menu.Menu(self.engine, self.keyChangeSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
1237
 
 
1238
    self.keySettings = self.refreshKeySettings(init = True)
 
1239
    self.keySettingsMenu = Menu.Menu(self.engine, self.keySettings, onClose = self.controlCheck, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
1240
    
 
1241
    InGameDisplaySettings = [
 
1242
      ConfigChoice(engine, engine.config, "game", "in_game_stars", autoApply = True, isQuickset = 2),#myfingershurt
 
1243
      ConfigChoice(engine, engine.config, "game", "accuracy_mode", autoApply = True),
 
1244
      ConfigChoice(engine, engine.config, "performance", "in_game_stats", autoApply = True, isQuickset = 1),#myfingershurt
 
1245
      ConfigChoice(engine, engine.config, "game", "game_time", autoApply = True),  
 
1246
      ConfigChoice(engine, engine.config, "video", "counting", autoApply = True, isQuickset = 2),
 
1247
    ]
 
1248
    InGameDisplayMenu = Menu.Menu(engine, InGameDisplaySettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
1249
      
 
1250
    modes = engine.video.getVideoModes()
 
1251
    modes.reverse()
 
1252
    Config.define("video",  "resolution", str,   "1024x768", text = _("Video Resolution"), options = ["%dx%d" % (m[0], m[1]) for m in modes], tipText = _("Set the resolution of the game. In windowed mode, higher values mean a larger screen."))
 
1253
    videoSettings = [
 
1254
      ConfigChoice(engine, engine.config, "coffee", "themename"),
 
1255
      ConfigChoice(engine, engine.config, "video",  "resolution"),
 
1256
      ConfigChoice(engine, engine.config, "video",  "fullscreen"),
 
1257
      ConfigChoice(engine, engine.config, "game", "stage_mode", autoApply = True),   #myfingershurt
 
1258
      ConfigChoice(engine, engine.config, "game", "use_graphical_submenu", autoApply = True, isQuickset = 1),
 
1259
      (_("Choose Default Neck >"), lambda: Dialogs.chooseNeck(self.engine), _("Choose your default neck. You still have to choose which neck you use for your character in the character select screen.")),
 
1260
      (_("In-Game Display Settings"), InGameDisplayMenu, _("Change what and where things appear in-game.")),
 
1261
    ]
 
1262
    self.videoSettingsMenu = Menu.Menu(engine, videoSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
1263
 
 
1264
    
 
1265
    volumeSettings = [
 
1266
      VolumeConfigChoice(engine, engine.config, "audio",  "guitarvol", autoApply = True),
 
1267
      VolumeConfigChoice(engine, engine.config, "audio",  "songvol", autoApply = True),
 
1268
      VolumeConfigChoice(engine, engine.config, "audio",  "screwupvol", autoApply = True),
 
1269
      VolumeConfigChoice(engine, engine.config, "audio",  "miss_volume", autoApply = True),
 
1270
      VolumeConfigChoice(engine, engine.config, "audio",  "single_track_miss_volume", autoApply = True),
 
1271
      VolumeConfigChoice(engine, engine.config, "audio",  "crowd_volume", autoApply = True), #akedrou
 
1272
      VolumeConfigChoice(engine, engine.config, "audio",  "kill_volume", autoApply = True), #MFH
 
1273
      ActiveConfigChoice(engine, engine.config, "audio",  "SFX_volume", autoApply = True, onChange = self.engine.data.SetAllSoundFxObjectVolumes, volume = True), #MFH
 
1274
      ActiveConfigChoice(engine, engine.config, "audio",  "menu_volume", autoApply = True, onChange = self.engine.mainMenu.setMenuVolume),
 
1275
    ]
 
1276
    volumeSettingsMenu = Menu.Menu(engine, volumeSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
1277
 
 
1278
    audioSettings = [
 
1279
      (_("Volume Settings"),    volumeSettingsMenu, _("Change the volume of game sounds.")),
 
1280
      ConfigChoice(engine, engine.config, "game", "star_claps", autoApply = True),      #myfingershurt
 
1281
      ConfigChoice(engine, engine.config, "game", "beat_claps", autoApply = True), #racer
 
1282
      ConfigChoice(engine, engine.config, "audio",  "whammy_effect", autoApply = True),     #MFH
 
1283
      ConfigChoice(engine, engine.config, "audio", "enable_crowd_tracks", autoApply = True), #akedrou
 
1284
    ]
 
1285
    audioSettingsMenu = Menu.Menu(engine, audioSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
1286
    
 
1287
    quickSettings = [
 
1288
      ConfigChoice(engine, engine.config, "quickset", "performance", autoApply = True),
 
1289
      ConfigChoice(engine, engine.config, "quickset", "gameplay", autoApply = True),
 
1290
    ]
 
1291
    quicksetMenu = Menu.Menu(engine, quickSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
1292
 
 
1293
    listSettings = [
 
1294
      (_("Change Setlist Path >"), self.baseLibrarySelect, _("Set the path to a folder named 'songs' that contains your songs.")),
 
1295
      ConfigChoice(engine, engine.config, "coffee", "song_display_mode", autoApply = True),
 
1296
      ConfigChoice(engine, engine.config, "game",  "sort_order", autoApply = True),
 
1297
      ConfigChoice(engine, engine.config, "game", "sort_direction", autoApply = True),
 
1298
      ConfigChoice(engine, engine.config, "game", "song_listing_mode", autoApply = True, isQuickset = 2),
 
1299
      ConfigChoice(engine, engine.config, "game", "quickplay_tiers", autoApply = True),  #myfingershurt
 
1300
      ConfigChoice(engine, engine.config, "game", "songcovertype", autoApply = True),
 
1301
      ConfigChoice(engine, engine.config, "game", "song_icons", autoApply = True),
 
1302
      ConfigChoice(engine, engine.config, "game", "songlist_instrument", autoApply = True), #MFH
 
1303
      ConfigChoice(engine, engine.config, "game", "songlist_difficulty", autoApply = True), #evilynux
 
1304
    ]
 
1305
    listSettingsMenu = Menu.Menu(engine, listSettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
1306
 
 
1307
    Cheats = self.refreshCheatSettings(init = True)
 
1308
    self.cheatMenu = Menu.Menu(engine, Cheats, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)
 
1309
    
 
1310
    settings = [
 
1311
      (_("Gameplay Settings"),   FoFiXBasicSettingsMenu, _("Settings that affect the rules of the game.")),
 
1312
      (_("Control Settings"),          self.keySettingsMenu, _("Create, delete, and edit your controls.")),
 
1313
      (_("Display Settings"),     self.videoSettingsMenu, _("Theme, neck, resolution, etc.")),
 
1314
      (_("Audio Settings"),      audioSettingsMenu, _("Volume controls, etc.")),
 
1315
      (_("Setlist Settings"),   listSettingsMenu, _("Settings that affect the setlist.")),
 
1316
      (_("Mods, Cheats, AI"), self.cheatMenu, _("Set Jurgen to play for you, or other cheats.")),
 
1317
      (_("%s Credits") % (engine.versionString), lambda: Dialogs.showCredits(engine), _("See who made this game.")), # evilynux - Show Credits!
 
1318
      (_("Quickset"), quicksetMenu, _("A quick way to set many advanced settings.")),
 
1319
      (_("See Advanced Options"), self.advancedSettings)
 
1320
    ]
 
1321
  
 
1322
    self.settingsToApply = FoFiXBasicSettings + \
 
1323
                           videoSettings + \
 
1324
                           self.modSettings
 
1325
  
 
1326
 
 
1327
 
 
1328
    Menu.Menu.__init__(self, engine, settings, name = "settings", onCancel = self.applySettings, pos = (self.opt_text_x, self.opt_text_y), textColor = self.opt_text_color, selectedColor = self.opt_selected_color)   #MFH - add position to this so we can move it
 
1329
 
 
1330
  def applySettings(self):
 
1331
    quickset(self.engine.config)
 
1332
    if self.engine.restartRequired or self.engine.quicksetRestart:
 
1333
      Dialogs.showMessage(self.engine, _("FoFiX needs to restart to apply setting changes."))
 
1334
      for option in self.settingsToApply:
 
1335
        if isinstance(option, ConfigChoice):
 
1336
          option.apply()
 
1337
      self.engine.restart()
 
1338
  
 
1339
  def refreshKeySettings(self, init = False):
 
1340
    choices = [ #the reacharound
 
1341
      Menu.Choice(_("Test Controls"), self.keyChangeMenu, tipText = _("Go here to test your controllers.")),
 
1342
      ActiveConfigChoice(self.engine, self.engine.config, "game", "control0", onChange = self.engine.input.reloadControls),
 
1343
      ActiveConfigChoice(self.engine, self.engine.config, "game", "control1", onChange = self.engine.input.reloadControls),
 
1344
      ActiveConfigChoice(self.engine, self.engine.config, "game", "control2", onChange = self.engine.input.reloadControls),
 
1345
      ActiveConfigChoice(self.engine, self.engine.config, "game", "control3", onChange = self.engine.input.reloadControls),
 
1346
      Menu.Choice(_("New Controller"),    lambda: createControl(self.engine, refresh = self.refreshKeySettings), tipText = _("Create a new controller to use.")),
 
1347
      Menu.Choice(_("Edit Controller"),   lambda: chooseControl(self.engine, refresh = self.refreshKeySettings), tipText = _("Edit a controller you have created.")),
 
1348
      Menu.Choice(_("Delete Controller"), lambda: chooseControl(self.engine, "delete", refresh = self.refreshKeySettings), tipText = _("Delete a controller you have created.")),
 
1349
      ActiveConfigChoice(self.engine, self.engine.config, "game", "p2_menu_nav", onChange = self.engine.input.reloadControls),#myfingershurt
 
1350
      ActiveConfigChoice(self.engine, self.engine.config, "game", "drum_navigation", onChange = self.engine.input.reloadControls),#myfingershurt
 
1351
      ActiveConfigChoice(self.engine, self.engine.config, "game", "key_checker_mode", onChange = self.engine.input.reloadControls),#myfingershurt
 
1352
    ]
 
1353
    if init:
 
1354
      return choices
 
1355
    self.engine.mainMenu.settingsMenuObject.keySettingsMenu.choices = choices
 
1356
  
 
1357
  def refreshCheatSettings(self, init = False):
 
1358
    choices = []
 
1359
    maxplayers = self.engine.config.get("performance", "max_players")
 
1360
    for i in range(maxplayers):
 
1361
      choices.append(ConfigChoice(self.engine, self.engine.config, "game", "jurg_p%d" % i, autoApply = True))
 
1362
    choicesb = [ConfigChoice(self.engine, self.engine.config, "game", "gh2_sloppy", autoApply = True),
 
1363
      ConfigChoice(self.engine, self.engine.config, "game", "whammy_saves_starpower", autoApply = True),#myfingershurt
 
1364
      ConfigChoice(self.engine, self.engine.config, "game",   "note_hit_window", autoApply = True), #alarian: defines hit window
 
1365
      ConfigChoice(self.engine, self.engine.config, "coffee", "hopo_frequency", autoApply = True),
 
1366
      ConfigChoice(self.engine, self.engine.config, "coffee", "failingEnabled", autoApply = True),
 
1367
      ConfigChoice(self.engine, self.engine.config, "audio",  "speed_factor", autoApply = True),     #MFH
 
1368
      ConfigChoice(self.engine, self.engine.config, "handicap",  "early_hit_window", autoApply = True),     #MFH
 
1369
      (_("Mod settings"), self.modSettingsMenu, _("Enable or disable any mods you have installed.")),]
 
1370
    choices.extend(choicesb)
 
1371
    if init:
 
1372
      return choices
 
1373
    self.engine.mainMenu.settingsMenuObject.cheatMenu.choices = choices
 
1374
  
 
1375
  def controlCheck(self):
 
1376
    control = [self.engine.config.get("game", "control0")]
 
1377
    self.keyCheckerMode = Config.get("game", "key_checker_mode")
 
1378
    if str(control[0]) == "None":
 
1379
      Dialogs.showMessage(self.engine, _("You must specify a controller for slot 1!"))
 
1380
      self.engine.view.pushLayer(self.keySettingsMenu)
 
1381
    else:
 
1382
      for i in range(1,4):
 
1383
        c = self.engine.config.get("game", "control%d" % i)
 
1384
        if c in control and str(c) != "None":
 
1385
          Dialogs.showMessage(self.engine, _("Controllers in slots %d and %d conflict. Setting %d to None.") % (control.index(c)+1, i+1, i+1))
 
1386
          self.engine.config.set("game", "control%d" % i, None)
 
1387
        else:
 
1388
          control.append(c)
 
1389
      self.engine.input.reloadControls()
 
1390
      if len(self.engine.input.controls.overlap) > 0 and self.keyCheckerMode > 0:
 
1391
        n = 0
 
1392
        for i in self.engine.input.controls.overlap:
 
1393
          if n > 1:
 
1394
            Dialogs.showMessage(self.engine, _("%d more conflicts.") % (len(self.engine.input.controls.overlap)-2))
 
1395
          Dialogs.showMessage(self.engine, i)
 
1396
          n+= 1
 
1397
        if self.keyCheckerMode == 2:
 
1398
          self.engine.view.pushLayer(self.keySettingsMenu)
 
1399
      self.refreshKeySettings()
 
1400
  
 
1401
  def advancedSettings(self):
 
1402
    Config.set("game", "adv_settings", True)
 
1403
    self.engine.advSettings = True
 
1404
    if not self.engine.restartRequired:
 
1405
      self.engine.view.popLayer(self)
 
1406
      self.engine.input.removeKeyListener(self)
 
1407
    else:
 
1408
      self.applySettings()
 
1409
  
 
1410
  def keyTest(self, controller):
 
1411
    if str(self.engine.input.controls.controls[controller]) == "None":
 
1412
      Dialogs.showMessage(self.engine, "No controller set for slot %d" % (controller+1))
 
1413
    else:
 
1414
      Dialogs.testKeys(self.engine, controller)
 
1415
  
 
1416
  def resetLanguageToEnglish(self):
 
1417
    Log.debug("settings.resetLanguageToEnglish function call...")
 
1418
    if self.engine.config.get("game", "language") != "":
 
1419
      self.engine.config.set("game", "language", "")
 
1420
      self.engine.restart()
 
1421
 
 
1422
  def baseLibrarySelect(self):
 
1423
    Log.debug("settings.baseLibrarySelect function call...")
 
1424
    newPath = Dialogs.chooseFile(self.engine, masks = ["*/*"], prompt = _("Choose a new songs directory."), dirSelect = True)
 
1425
    if newPath != None:
 
1426
      Config.set("game", "base_library", os.path.dirname(newPath))
 
1427
      Config.set("game", "selected_library", os.path.basename(newPath))
 
1428
      Config.set("game", "selected_song", "")
 
1429
      self.engine.resource.refreshBaseLib()   #myfingershurt - to let user continue with new songpath without restart
 
1430
 
 
1431
def quickset(config):
 
1432
  #akedrou - quickset (based on Fablaculp's Performance Autoset)
 
1433
  perfSetNum = config.get("quickset","performance")
 
1434
  gameSetNum = config.get("quickset","gameplay")
 
1435
  
 
1436
  if gameSetNum == 1:
 
1437
    config.set("game", "sp_notes_while_active", 1)
 
1438
    config.set("game", "bass_groove_enable", 1)
 
1439
    config.set("game", "big_rock_endings", 1)
 
1440
    config.set("game", "in_game_stars", 1)
 
1441
    config.set("coffee", "song_display_mode", 4)
 
1442
    config.set("game", "mark_solo_sections", 2)
 
1443
    Log.debug("Quickset Gameplay - Theme-Based")
 
1444
    
 
1445
  elif gameSetNum == 2:
 
1446
    config.set("game", "sp_notes_while_active", 2)
 
1447
    config.set("game", "bass_groove_enable", 2)
 
1448
    config.set("game", "big_rock_endings", 2)
 
1449
    config.set("game", "mark_solo_sections", 3)
 
1450
    Log.debug("Quickset Gameplay - MIDI-Based")
 
1451
    
 
1452
  elif gameSetNum == 3:
 
1453
    config.set("game", "sp_notes_while_active", 3)
 
1454
    config.set("game", "bass_groove_enable", 3)
 
1455
    config.set("game", "big_rock_endings", 2)
 
1456
    config.set("game", "in_game_stars", 2)
 
1457
    config.set("game", "counting", True)
 
1458
    config.set("game", "mark_solo_sections", 1)
 
1459
    Log.debug("Quickset Gameplay - RB style")
 
1460
    
 
1461
  elif gameSetNum == 4:
 
1462
    config.set("game", "sp_notes_while_active", 0)
 
1463
    config.set("game", "bass_groove_enable", 0)
 
1464
    config.set("game", "big_rock_endings", 0)
 
1465
    config.set("game", "in_game_stars", 0)
 
1466
    config.set("coffee", "song_display_mode", 1)
 
1467
    config.set("game", "counting", False)
 
1468
    config.set("game", "mark_solo_sections", 0)
 
1469
    Log.debug("Quickset Gameplay - GH style")
 
1470
    
 
1471
  elif gameSetNum == 5: # This needs work.
 
1472
    config.set("game", "sp_notes_while_active", 0)
 
1473
    config.set("game", "bass_groove_enable", 0)
 
1474
    config.set("game", "big_rock_endings", 0)
 
1475
    config.set("game", "in_game_stars", 0)
 
1476
    config.set("coffee", "song_display_mode", 1)
 
1477
    config.set("game", "counting", True)
 
1478
    config.set("game", "mark_solo_sections", 1)
 
1479
    Log.debug("Quickset Gameplay - WT style")
 
1480
    
 
1481
  # elif gameSetNum == 6: #FoFiX mode - perhaps soon.
 
1482
    
 
1483
  else:
 
1484
    Log.debug("Quickset Gameplay - Manual")
 
1485
  
 
1486
  if perfSetNum == 1:
 
1487
    config.set("engine", "highpriority", False)
 
1488
    config.set("performance", "game_priority", 2)
 
1489
    config.set("performance", "starspin", False)
 
1490
    config.set("game", "rb_midi_lyrics", 0)
 
1491
    config.set("game", "rb_midi_sections", 0)
 
1492
    config.set("game", "gsolo_acc_disp", 0)
 
1493
    config.set("game", "incoming_neck_mode", 0)
 
1494
    config.set("game", "midi_lyric_mode", 2)
 
1495
    config.set("video", "fps", 60)
 
1496
    config.set("video", "multisamples", 0)
 
1497
    config.set("video", "use_shaders", False)
 
1498
    config.set("coffee", "game_phrases", 0)
 
1499
    config.set("game", "partial_stars", 0)
 
1500
    config.set("game", "songlistrotation", False)
 
1501
    config.set("game", "song_listing_mode", 0)
 
1502
    config.set("game", "song_display_mode", 1)
 
1503
    config.set("game", "stage_animate", 0)
 
1504
    config.set("game", "lyric_mode", 0)
 
1505
    config.set("game", "use_graphical_submenu", 0)
 
1506
    config.set("audio", "enable_crowd_tracks", 0)
 
1507
    config.set("performance", "in_game_stats", 0)
 
1508
    config.set("performance", "static_strings", True)
 
1509
    config.set("performance", "disable_libcount", True)
 
1510
    config.set("performance", "killfx", 2)
 
1511
    config.set("performance", "star_score_updates", 0)
 
1512
    config.set("performance", "cache_song_metadata", False)
 
1513
    Log.debug("Quickset Performance - Fastest")
 
1514
    
 
1515
  elif perfSetNum == 2:
 
1516
    config.set("engine", "highpriority", False)
 
1517
    config.set("performance", "game_priority", 2)
 
1518
    config.set("performance", "starspin", False)
 
1519
    config.set("game", "rb_midi_lyrics", 1)
 
1520
    config.set("game", "rb_midi_sections", 1)
 
1521
    config.set("game", "gsolo_acc_disp", 1)
 
1522
    config.set("game", "incoming_neck_mode", 1)
 
1523
    config.set("game", "midi_lyric_mode", 2)
 
1524
    config.set("video", "fps", 60)
 
1525
    config.set("video", "multisamples", 2)
 
1526
    config.set("coffee", "game_phrases", 1)
 
1527
    config.set("game", "partial_stars", 1)
 
1528
    config.set("game", "songlistrotation", False)
 
1529
    config.set("game", "song_listing_mode", 0)
 
1530
    config.set("game", "stage_animate", 0)
 
1531
    config.set("game", "lyric_mode", 2)
 
1532
    config.set("game", "use_graphical_submenu", 0)
 
1533
    config.set("audio", "enable_crowd_tracks", 1)
 
1534
    config.set("performance", "in_game_stats", 0)
 
1535
    config.set("performance", "static_strings", True)
 
1536
    config.set("performance", "disable_libcount", True)
 
1537
    config.set("performance", "killfx", 0)
 
1538
    config.set("performance", "star_score_updates", 0)
 
1539
    config.set("performance", "cache_song_metadata", True)
 
1540
    Log.debug("Quickset Performance - Fast")
 
1541
    
 
1542
  elif perfSetNum == 3:
 
1543
    config.set("engine", "highpriority", False)
 
1544
    config.set("performance", "game_priority", 2)
 
1545
    config.set("performance", "starspin", True)
 
1546
    config.set("game", "rb_midi_lyrics", 2)
 
1547
    config.set("game", "rb_midi_sections", 2)
 
1548
    config.set("game", "gsolo_acc_disp", 1)
 
1549
    config.set("game", "incoming_neck_mode", 2)
 
1550
    config.set("game", "midi_lyric_mode", 2)
 
1551
    config.set("video", "fps", 80)
 
1552
    config.set("video", "multisamples", 4)
 
1553
    config.set("coffee", "game_phrases", 2)
 
1554
    config.set("game", "partial_stars", 1)
 
1555
    config.set("game", "songlistrotation", True)
 
1556
    config.set("game", "lyric_mode", 2)
 
1557
    config.set("game", "use_graphical_submenu", 1)
 
1558
    config.set("audio", "enable_crowd_tracks", 1)
 
1559
    config.set("performance", "in_game_stats", 2)
 
1560
    config.set("performance", "static_strings", True)
 
1561
    config.set("performance", "disable_libcount", True)
 
1562
    config.set("performance", "killfx", 0)
 
1563
    config.set("performance", "star_score_updates", 1)
 
1564
    config.set("performance", "cache_song_metadata", True)
 
1565
    Log.debug("Quickset Performance - Quality")
 
1566
    
 
1567
  elif perfSetNum == 4:
 
1568
    config.set("engine", "highpriority", False)
 
1569
    config.set("performance", "game_priority", 2)
 
1570
    config.set("performance", "starspin", True)
 
1571
    config.set("game", "rb_midi_lyrics", 2)
 
1572
    config.set("game", "rb_midi_sections", 2)
 
1573
    config.set("game", "gsolo_acc_disp", 2)
 
1574
    config.set("game", "incoming_neck_mode", 2)
 
1575
    config.set("game", "midi_lyric_mode", 0)
 
1576
    config.set("video", "fps", 80)
 
1577
    config.set("video", "multisamples", 4)
 
1578
    config.set("video", "use_shaders", True)
 
1579
    config.set("coffee", "game_phrases", 2)
 
1580
    config.set("game", "partial_stars", 1)
 
1581
    config.set("game", "songlistrotation", True)
 
1582
    config.set("game", "lyric_mode", 2)
 
1583
    config.set("game", "use_graphical_submenu", 1)
 
1584
    config.set("audio", "enable_crowd_tracks", 1)
 
1585
    config.set("performance", "in_game_stats", 2)
 
1586
    config.set("performance", "static_strings", False)
 
1587
    config.set("performance", "disable_libcount", False)
 
1588
    config.set("performance", "killfx", 0)
 
1589
    config.set("performance", "star_score_updates", 1)
 
1590
    config.set("performance", "cache_song_metadata", True)
 
1591
    Log.debug("Quickset Performance - Highest Quality")
 
1592
    
 
1593
  else:
 
1594
    Log.debug("Quickset Performance - Manual")
 
1595
 
 
1596
class GameSettingsMenu(Menu.Menu):
 
1597
  def __init__(self, engine, gTextColor, gSelectedColor, players):
 
1598
 
 
1599
    self.logClassInits = Config.get("game", "log_class_inits")
 
1600
    if self.logClassInits == 1:
 
1601
      Log.debug("GameSettingsMenu class init (Settings.py)...")
 
1602
    
 
1603
    Cheats = []
 
1604
    
 
1605
    for i, player in enumerate(players):
 
1606
      Cheats.append(ConfigChoice(engine, engine.config, "game", "jurg_p%d" % i, autoApply = True))#Jurgen config -- Spikehead777
 
1607
      if player.part.id != VOCAL_PART:
 
1608
        Cheats.append(ConfigChoice(engine, engine.config, "game", "jurg_logic_p%d" % i, autoApply = True))#MFH
 
1609
     #MFH
 
1610
    CheatMenu = Menu.Menu(engine, Cheats, pos = (.350, .310), viewSize = 5, textColor = gTextColor, selectedColor = gSelectedColor)
 
1611
    
 
1612
    settings = [
 
1613
      (_("Cheats"), CheatMenu),
 
1614
      VolumeConfigChoice(engine, engine.config, "audio",  "guitarvol", autoApply = True),
 
1615
      VolumeConfigChoice(engine, engine.config, "audio",  "songvol", autoApply = True),
 
1616
      VolumeConfigChoice(engine, engine.config, "audio",  "screwupvol", autoApply = True),
 
1617
      VolumeConfigChoice(engine, engine.config, "audio",  "miss_volume", autoApply = True),
 
1618
      VolumeConfigChoice(engine, engine.config, "audio",  "single_track_miss_volume", autoApply = True),
 
1619
      VolumeConfigChoice(engine, engine.config, "audio",  "crowd_volume", autoApply = True),
 
1620
      VolumeConfigChoice(engine, engine.config, "audio",  "kill_volume", autoApply = True), #MFH
 
1621
      ActiveConfigChoice(engine, engine.config, "audio",  "SFX_volume", autoApply = True, onChange = engine.data.SetAllSoundFxObjectVolumes, volume = True), #MFH
 
1622
      ConfigChoice(engine, engine.config, "audio", "enable_crowd_tracks", autoApply = True), #akedrou
 
1623
      ConfigChoice(engine, engine.config, "audio",  "delay", autoApply = True),   #myfingershurt: so the a/v delay can be adjusted in-game
 
1624
      ConfigChoice(engine, engine.config, "game", "stage_rotate_delay", autoApply = True),   #myfingershurt - user defined stage rotate delay
 
1625
      ConfigChoice(engine, engine.config, "game", "stage_animate_delay", autoApply = True),   #myfingershurt - user defined stage rotate delay
 
1626
      #ConfigChoice(engine, engine.config, "player0",  "leftymode", autoApply = True),
 
1627
      #ConfigChoice(engine, engine.config, "player1",  "leftymode", autoApply = True), #QQstarS
 
1628
    ]
 
1629
    Menu.Menu.__init__(self, engine, settings, pos = (.360, .250), viewSize = 5, textColor = gTextColor, selectedColor = gSelectedColor, showTips = False) #Worldrave- Changed Pause-Submenu Position more centered until i add a theme.ini setting.
 
1630
 
 
1631
class GameCareerSettingsMenu(Menu.Menu):
 
1632
  def __init__(self, engine, gTextColor, gSelectedColor, players):
 
1633
 
 
1634
    self.logClassInits = Config.get("game", "log_class_inits")
 
1635
    if self.logClassInits == 1:
 
1636
      Log.debug("GameSettingsMenu class init (Settings.py)...")
 
1637
    players = None
 
1638
    settings = [
 
1639
      VolumeConfigChoice(engine, engine.config, "audio",  "guitarvol", autoApply = True),
 
1640
      VolumeConfigChoice(engine, engine.config, "audio",  "songvol", autoApply = True),
 
1641
      VolumeConfigChoice(engine, engine.config, "audio",  "screwupvol", autoApply = True),
 
1642
      VolumeConfigChoice(engine, engine.config, "audio",  "miss_volume", autoApply = True),
 
1643
      VolumeConfigChoice(engine, engine.config, "audio",  "single_track_miss_volume", autoApply = True),
 
1644
      VolumeConfigChoice(engine, engine.config, "audio",  "crowd_volume", autoApply = True),
 
1645
      VolumeConfigChoice(engine, engine.config, "audio",  "kill_volume", autoApply = True), #MFH
 
1646
      ActiveConfigChoice(engine, engine.config, "audio",  "SFX_volume", autoApply = True, onChange = engine.data.SetAllSoundFxObjectVolumes, volume = True), #MFH
 
1647
      ConfigChoice(engine, engine.config, "audio", "enable_crowd_tracks", autoApply = True), #akedrou
 
1648
      ConfigChoice(engine, engine.config, "audio",  "delay", autoApply = True),   #myfingershurt: so the a/v delay can be adjusted in-game
 
1649
      ConfigChoice(engine, engine.config, "game", "stage_rotate_delay", autoApply = True),   #myfingershurt - user defined stage rotate delay
 
1650
      ConfigChoice(engine, engine.config, "game", "stage_animate_delay", autoApply = True),   #myfingershurt - user defined stage rotate delay
 
1651
      #ConfigChoice(engine, engine.config, "player0",  "leftymode", autoApply = True),
 
1652
      #ConfigChoice(engine, engine.config, "player1",  "leftymode", autoApply = True), #QQstarS
 
1653
    ]
 
1654
    Menu.Menu.__init__(self, engine, settings, pos = (.360, .250), viewSize = 5, textColor = gTextColor, selectedColor = gSelectedColor, showTips = False) #Worldrave- Changed Pause-Submenu Position more centered until i add a theme.ini setting.