implement sound list and improved emote mod handling

This commit is contained in:
cidoku 2025-10-27 01:22:30 -03:00
parent c613a63d04
commit 19743b5c47
4 changed files with 39 additions and 20 deletions

View File

@ -26,8 +26,10 @@ Features added since the last commit of
- Pick a character and join an area automatically on join - Pick a character and join an area automatically on join
- Demo recording and playback with a seekbar, no need to send messages to OOC - Demo recording and playback with a seekbar, no need to send messages to OOC
- Pair with players directly from the player list - Pair with players directly from the player list
- Moderators can kick and ban players directly from the player list
- Playing music over HTTPS (on systems where the BASS library can't do it on its - Playing music over HTTPS (on systems where the BASS library can't do it on its
own) own)
- Sound list
- Connections over secure websockets (wss) - Connections over secure websockets (wss)
- FLAC playback - FLAC playback
- Module file playback (.mod, .xm, .it, .s3m) - Module file playback (.mod, .xm, .it, .s3m)

View File

@ -1,4 +1,4 @@
GAME_VERSION = "2.9.3" GAME_VERSION = "2.9.4"
AOpath = "base/" AOpath = "base/"
AO2XPpath = "AO2XPbase/" AO2XPpath = "AO2XPbase/"
@ -35,6 +35,12 @@ EFFECTS = 30
BLIPS = 31 BLIPS = 31
SLIDE = 32 SLIDE = 32
NOPRE = 0
PRE = 1
PRE_SHOUT = 2
NOPRE_ZOOM = 5
NOPRE_ZOOM_SHOUT = 6
INLINE_BLUE = 0 INLINE_BLUE = 0
INLINE_GREEN = 1 INLINE_GREEN = 1
INLINE_ORANGE = 2 INLINE_ORANGE = 2

View File

@ -1535,7 +1535,7 @@ class GUI(QtGui.QWidget):
self.boxSounds.currentIndexChanged.connect(self.ICChatFocus) self.boxSounds.currentIndexChanged.connect(self.ICChatFocus)
self.boxSounds.setToolTip('Play this sound effect') self.boxSounds.setToolTip('Play this sound effect')
self.boxSounds.setObjectName('ui_sfx_dropdown') self.boxSounds.setObjectName('ui_sfx_dropdown')
self.boxSounds.addItem("Default") self.populateSoundList()
self.cbFlip = QtGui.QCheckBox(self) self.cbFlip = QtGui.QCheckBox(self)
self.cbFlip.stateChanged.connect(self.changeFlipCheck) self.cbFlip.stateChanged.connect(self.changeFlipCheck)
@ -3117,8 +3117,9 @@ class GUI(QtGui.QWidget):
text = "".join(l) text = "".join(l)
emote = self.charEmotes[self.selectedEmote] emote = self.charEmotes[self.selectedEmote]
pre = (emote[1] != "-")
if self.cbNoInterrupt.isChecked(): if self.cbNoInterrupt.isChecked() or not pre:
modifier = 0 modifier = 0
else: else:
modifier = self.playPreanim modifier = self.playPreanim
@ -3167,8 +3168,16 @@ class GUI(QtGui.QWidget):
msg += emote[2] + "#" #anim msg += emote[2] + "#" #anim
msg += text + "#" msg += text + "#"
msg += self.charSide + "#" msg += self.charSide + "#"
msg += (ini.get_sound(self.boxSounds.currentText(), self.charName) if self.boxSounds.currentIndex() > 0 else emote[4]) + "#" #sfx
msg += emote[4] + "#" # sfx
if self.boxSounds.currentIndex() > 0:
msg += unicode(self.boxSounds.currentText()) + "#"
elif pre and not self.playPreanim:
msg += "1#"
else:
msg += emote[4] + "#"
#msg += emote[4] + "#"
msg += str(modifier) + "#" #emote modifier msg += str(modifier) + "#" #emote modifier
msg += str(self.myChar) + "#" #character ID msg += str(self.myChar) + "#" #character ID
msg += emote[5] + "#" #sfx delay msg += emote[5] + "#" #sfx delay
@ -3461,9 +3470,9 @@ class GUI(QtGui.QWidget):
fShowname = mChatMessage[SHOWNAME] fShowname = mChatMessage[SHOWNAME]
if self.messageQueue: if self.messageQueue:
chatMsgComp = decodeAOString(self.messageQueue[0].split('#')[5]) chatMsgComp = decodeAOString(self.messageQueue[0].split('#')[5]).strip()
examine = chatMsgComp == ">" or chatMsgComp == "<" or chatMsgComp == "=" examine = chatMsgComp == ">" or chatMsgComp == "<" or chatMsgComp == "="
special = not chatMsgComp or chatMsgComp.isspace() special = not chatMsgComp
if examine or (fCharId == self.myChar and (special or mChatMessage[CHATMSG] == chatMsgComp)): # our message showed up if examine or (fCharId == self.myChar and (special or mChatMessage[CHATMSG] == chatMsgComp)): # our message showed up
del self.messageQueue[0] del self.messageQueue[0]
self.queueItems.takeItem(0) self.queueItems.takeItem(0)
@ -3480,6 +3489,7 @@ class GUI(QtGui.QWidget):
# Some characters use " - " instead of "-" for no preanim. # Some characters use " - " instead of "-" for no preanim.
mChatMessage[PREANIM] = mChatMessage[PREANIM].strip() mChatMessage[PREANIM] = mChatMessage[PREANIM].strip()
# TODO: Make logging format customizable
t = time.localtime() t = time.localtime()
logcharName = fChar logcharName = fChar
@ -3715,7 +3725,6 @@ class GUI(QtGui.QWidget):
side = self.mChatMessage[SIDE] side = self.mChatMessage[SIDE]
emoteMod = int(self.mChatMessage[EMOTE_MOD]) emoteMod = int(self.mChatMessage[EMOTE_MOD])
no_preanim = not self.mChatMessage[PREANIM] or self.mChatMessage[PREANIM] == "-"
# AO 2.8: always offset player # AO 2.8: always offset player
hor_offset = vert_offset = 0 hor_offset = vert_offset = 0
@ -3821,16 +3830,13 @@ class GUI(QtGui.QWidget):
else: else:
self.slideLastPos = None self.slideLastPos = None
if (emoteMod == 1 or emoteMod == 2 or emoteMod == 6) and self.mChatMessage[PREANIM] != "-": if (emoteMod == PRE or emoteMod == PRE_SHOUT or emoteMod == NOPRE_ZOOM_SHOUT):
# sfxDelay = int(self.mChatMessage[SFX_DELAY]) * 60
# if sfxDelay > 0:
# self.sfxDelayTimer.start(sfxDelay)
# else:
# self.playSfx()
self.setBench(True) self.setBench(True)
self.playPre(False) self.playPre(False)
elif emoteMod == 0 or emoteMod == 5 or no_preanim: elif emoteMod == NOPRE or emoteMod == NOPRE_ZOOM:
if self.mChatMessage[NO_INTERRUPT] == "0" or no_preanim: if self.mChatMessage[NO_INTERRUPT] == "0":
if self.mChatMessage[SFX] not in ["0", "1"]:
self.playSfx()
self.handleChatMessage3() self.handleChatMessage3()
else: else:
self.playPre(True) self.playPre(True)
@ -4268,6 +4274,15 @@ class GUI(QtGui.QWidget):
audio.setHandleAttr(self.sndObjection, BASS_ATTRIB_VOL, self.sliSoundVolume.value() / 100.0) audio.setHandleAttr(self.sndObjection, BASS_ATTRIB_VOL, self.sliSoundVolume.value() / 100.0)
audio.playHandle(self.sndObjection, True) audio.playHandle(self.sndObjection, True)
def populateSoundList(self):
self.boxSounds.clear()
self.boxSounds.addItem("Default")
with open("base/soundlist.ini") as f:
for sound in f.read().split("\n"):
if not sound: continue
self.boxSounds.addItem(sound.strip())
def playSfx(self): def playSfx(self):
sfxName = self.mChatMessage[SFX] sfxName = self.mChatMessage[SFX]
if sfxName == "1" or sfxName == "0": if sfxName == "1" or sfxName == "0":

4
ini.py
View File

@ -135,10 +135,6 @@ def get_effect_sound(fx_name, char):
return read_ini(inifile, section, "sound", "").strip() return read_ini(inifile, section, "sound", "").strip()
return read_sectionless_ini(default_path, fx_name).strip() return read_sectionless_ini(default_path, fx_name).strip()
# TODO: Sound list not implemented
def get_sound(fx_name, char):
return ""
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"