sound: more channels for sound effects + simplify effects list
This commit is contained in:
parent
703a458160
commit
683af1ca34
76
gameview.py
76
gameview.py
@ -1033,7 +1033,13 @@ class Chatbox(QtGui.QLabel):
|
|||||||
|
|
||||||
class GUI(QtGui.QWidget):
|
class GUI(QtGui.QWidget):
|
||||||
gamewindow = None
|
gamewindow = None
|
||||||
sound = None
|
# In theory 3 sounds may play at the same time: character, evidence sweep,
|
||||||
|
# effect
|
||||||
|
soundChannels = 3
|
||||||
|
soundChannel = 0
|
||||||
|
sound = []
|
||||||
|
for i in range(soundChannels):
|
||||||
|
sound.append(None)
|
||||||
music = None
|
music = None
|
||||||
nextCharacterIsNotSpecial = False
|
nextCharacterIsNotSpecial = False
|
||||||
messageIsCentered = False
|
messageIsCentered = False
|
||||||
@ -2250,8 +2256,9 @@ class GUI(QtGui.QWidget):
|
|||||||
audio.playHandle(self.music, False)
|
audio.playHandle(self.music, False)
|
||||||
|
|
||||||
def changeSoundVolume(self, value):
|
def changeSoundVolume(self, value):
|
||||||
if self.sound:
|
for s in self.sound:
|
||||||
audio.setHandleAttr(self.sound, BASS_ATTRIB_VOL, value / 100.0)
|
if s:
|
||||||
|
audio.setHandleAttr(self.sound, BASS_ATTRIB_VOL, value / 100.0)
|
||||||
audio.setHandleAttr(self.sndRealization, BASS_ATTRIB_VOL, value / 100.0)
|
audio.setHandleAttr(self.sndRealization, BASS_ATTRIB_VOL, value / 100.0)
|
||||||
audio.setHandleAttr(self.wtceSfx, BASS_ATTRIB_VOL, value / 100.0)
|
audio.setHandleAttr(self.wtceSfx, BASS_ATTRIB_VOL, value / 100.0)
|
||||||
audio.setHandleAttr(self.guiltySfx, BASS_ATTRIB_VOL, value / 100.0)
|
audio.setHandleAttr(self.guiltySfx, BASS_ATTRIB_VOL, value / 100.0)
|
||||||
@ -3148,35 +3155,36 @@ class GUI(QtGui.QWidget):
|
|||||||
else:
|
else:
|
||||||
msg += "chat#"
|
msg += "chat#"
|
||||||
|
|
||||||
msg += emote[1]+"#" #pre-anim
|
msg += emote[1] + "#" #pre-anim
|
||||||
msg += self.charName.title() + "#"
|
msg += self.charName.title() + "#"
|
||||||
msg += emote[2]+"#" #anim
|
msg += emote[2] + "#" #anim
|
||||||
msg += text+"#"
|
msg += text + "#"
|
||||||
msg += self.charSide+"#"
|
msg += self.charSide + "#"
|
||||||
msg += (ini.get_effect_sound(self.boxEffects.currentText(), self.charName) if self.boxEffects.currentIndex() > 0 else emote[4])+"#" #sfx
|
#msg += (ini.get_effect_sound(self.boxEffects.currentText(), self.charName) if self.boxEffects.currentIndex() > 0 else emote[4]) + "#" #sfx
|
||||||
msg += str(modifier)+"#" #emote modifier
|
msg += emote[4] + "#"
|
||||||
msg += str(self.myChar)+"#" #character ID
|
msg += str(modifier) + "#" #emote modifier
|
||||||
msg += emote[5]+"#" #sfx delay
|
msg += str(self.myChar) + "#" #character ID
|
||||||
msg += str(objection)+"#"
|
msg += emote[5] + "#" #sfx delay
|
||||||
msg += str((self.selectedEvidence + 1) * int(self.present))+"#" #selected evidence
|
msg += str(objection) + "#"
|
||||||
|
msg += str((self.selectedEvidence + 1) * int(self.present)) + "#" #selected evidence
|
||||||
|
|
||||||
if self.present:
|
if self.present:
|
||||||
self.present = False
|
self.present = False
|
||||||
self.btnEvidencePresent.setPixmap(self.btnEvidencePresent.button_off)
|
self.btnEvidencePresent.setPixmap(self.btnEvidencePresent.button_off)
|
||||||
|
|
||||||
if "flipping" in self.features:
|
if "flipping" in self.features:
|
||||||
msg += str(self.myFlip)+"#"
|
msg += str(self.myFlip) + "#"
|
||||||
else:
|
else:
|
||||||
msg += str(self.myChar)+"#" # old AO servers send a second charID in the message because drunk fanat
|
msg += str(self.myChar) + "#" # old AO servers send a second charID in the message because drunk fanat
|
||||||
|
|
||||||
msg += str(int(self.btnRealization.isPressed()))+"#"
|
msg += str(int(self.btnRealization.isPressed())) + "#"
|
||||||
msg += str(self.myChatColor)+"#"
|
msg += str(self.myChatColor) + "#"
|
||||||
|
|
||||||
if "cccc_ic_support" in self.features:
|
if "cccc_ic_support" in self.features:
|
||||||
showname = self.showname.decode('utf-8')
|
showname = self.showname.decode('utf-8')
|
||||||
if self.showname == "" and not self.charShowname == "":
|
if self.showname == "" and not self.charShowname == "":
|
||||||
showname = self.charShowname
|
showname = self.charShowname
|
||||||
msg += showname+"#" # custom showname
|
msg += showname + "#" # custom showname
|
||||||
if self.cbPair.isChecked():
|
if self.cbPair.isChecked():
|
||||||
msg += str(self.boxPair.currentIndex()) # pair charID
|
msg += str(self.boxPair.currentIndex()) # pair charID
|
||||||
if "effects" in self.features:
|
if "effects" in self.features:
|
||||||
@ -3190,12 +3198,12 @@ class GUI(QtGui.QWidget):
|
|||||||
if "y_offset" in self.features: # AO 2.9
|
if "y_offset" in self.features: # AO 2.9
|
||||||
msg += str(self.sliPairOffset.value()) + "&" + str(-self.sliPairOffsetY.value()) + "#"
|
msg += str(self.sliPairOffset.value()) + "&" + str(-self.sliPairOffsetY.value()) + "#"
|
||||||
else:
|
else:
|
||||||
msg += str(self.sliPairOffset.value())+"#"
|
msg += str(self.sliPairOffset.value()) + "#"
|
||||||
|
|
||||||
msg += str(int(self.cbNoInterrupt.isChecked()))+"#" # NoInterrupt(TM)
|
msg += str(int(self.cbNoInterrupt.isChecked())) + "#" # NoInterrupt(TM)
|
||||||
|
|
||||||
if "looping_sfx" in self.features: # AO 2.8
|
if "looping_sfx" in self.features: # AO 2.8
|
||||||
msg += emote[6]+"#" # loop sound?
|
msg += emote[6] + "#" # loop sound?
|
||||||
msg += "%d#" % self.btnShake.isPressed() # screen shake
|
msg += "%d#" % self.btnShake.isPressed() # screen shake
|
||||||
emotes_to_check = [emote[1], "(b)"+emote[2], "(b)/"+emote[2], "(a)"+emote[2], "(a)/"+emote[2] ]
|
emotes_to_check = [emote[1], "(b)"+emote[2], "(b)/"+emote[2], "(a)"+emote[2], "(a)/"+emote[2] ]
|
||||||
effects_to_check = ["_FrameScreenshake", "_FrameRealization", "_FrameSFX"]
|
effects_to_check = ["_FrameScreenshake", "_FrameRealization", "_FrameSFX"]
|
||||||
@ -3209,7 +3217,7 @@ class GUI(QtGui.QWidget):
|
|||||||
if sfx_frames:
|
if sfx_frames:
|
||||||
packet += "|" + sfx_frames
|
packet += "|" + sfx_frames
|
||||||
packet += "^"
|
packet += "^"
|
||||||
msg += packet+"#"
|
msg += packet + "#"
|
||||||
|
|
||||||
if "additive" in self.features:
|
if "additive" in self.features:
|
||||||
msg += "%d#" % self.cbAdditive.isChecked()
|
msg += "%d#" % self.cbAdditive.isChecked()
|
||||||
@ -4259,18 +4267,24 @@ class GUI(QtGui.QWidget):
|
|||||||
self.playSound(sfxName)
|
self.playSound(sfxName)
|
||||||
|
|
||||||
def playSound(self, sfx):
|
def playSound(self, sfx):
|
||||||
if self.sound:
|
self.soundChannel = (self.soundChannel + 1) % self.soundChannels
|
||||||
if audio.handleIsActive(self.sound):
|
|
||||||
audio.stopHandle(self.sound)
|
if self.sound[self.soundChannel]:
|
||||||
audio.freeHandle(self.sound)
|
if audio.handleIsActive(self.sound[self.soundChannel]):
|
||||||
|
audio.stopHandle(self.sound[self.soundChannel])
|
||||||
|
audio.freeHandle(self.sound[self.soundChannel])
|
||||||
|
|
||||||
path = testPath(AOpath + 'sounds/general/' + sfx, AOpath + 'sounds/general/' + sfx + '.wav', AOpath + 'sounds/general/' + sfx + '.opus')
|
path = testPath(
|
||||||
|
AOpath + 'sounds/general/' + sfx,
|
||||||
|
AOpath + 'sounds/general/' + sfx + '.wav',
|
||||||
|
AOpath + 'sounds/general/' + sfx + '.opus'
|
||||||
|
)
|
||||||
|
|
||||||
if path:
|
if path:
|
||||||
self.sound = audio.loadHandle(False, path, 0, 0, 0)
|
self.sound[self.soundChannel] = audio.loadHandle(False, path, 0, 0, 0)
|
||||||
audio.setHandleAttr(self.sound, BASS_ATTRIB_VOL, self.sliSoundVolume.value() / 100.0)
|
audio.setHandleAttr(self.sound[self.soundChannel], BASS_ATTRIB_VOL, self.sliSoundVolume.value() / 100.0)
|
||||||
if self.sound:
|
if self.sound[self.soundChannel]:
|
||||||
audio.playHandle(self.sound, True)
|
audio.playHandle(self.sound[self.soundChannel], True)
|
||||||
|
|
||||||
def playMusic(self, mus):
|
def playMusic(self, mus):
|
||||||
self.stopMusic()
|
self.stopMusic()
|
||||||
|
|||||||
16
ini.py
16
ini.py
@ -138,16 +138,16 @@ def get_effect_sound(fx_name, char):
|
|||||||
def get_effects(char):
|
def get_effects(char):
|
||||||
p_effect = read_ini("base/characters/"+char+"/char.ini", "options", "effects", "default/effects")
|
p_effect = read_ini("base/characters/"+char+"/char.ini", "options", "effects", "default/effects")
|
||||||
p_path = "base/misc/"+p_effect+"/effects.ini"
|
p_path = "base/misc/"+p_effect+"/effects.ini"
|
||||||
default_path = "AO2XPbase/themes/default/effects/effects.ini"
|
# default_path = "AO2XPbase/themes/default/effects/effects.ini"
|
||||||
|
|
||||||
effects = []
|
# effects = []
|
||||||
|
|
||||||
if exists(default_path):
|
# if exists(default_path):
|
||||||
with open(default_path, 'r') as file:
|
# with open(default_path, 'r') as file:
|
||||||
for line in file:
|
# for line in file:
|
||||||
effects.append(line.split("=")[0].strip())
|
# effects.append(line.split("=")[0].strip())
|
||||||
else:
|
# else:
|
||||||
effects = ["realization", "hearts", "reaction", "impact"]
|
effects = ["realization", "hearts", "reaction", "impact"]
|
||||||
|
|
||||||
if not exists(p_path): return effects
|
if not exists(p_path): return effects
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user