fixed objection sounds + separate label for pillow animations in aomovie

This commit is contained in:
cidoku 2025-02-14 00:22:55 -03:00
parent 0efebb6135
commit 66a6e4a77f
2 changed files with 30 additions and 13 deletions

View File

@ -6,9 +6,12 @@ from pybass_constants import *
audio.init()
mus = "http://files.catbox.moe/nyp4xo.mp3"
Miles = unicode("Miles")
music = audio.loadURLhandle(mus, 0, BASS_STREAM_BLOCK)
mus = "base/characters/"+str(Miles)+"/holdit.wav"
music = audio.loadhandle(False, mus, 0, 0, 0)
#music = audio.loadURLhandle(mus, 0, BASS_STREAM_BLOCK)
print "Trying to play", mus
if music:

View File

@ -319,15 +319,15 @@ class AOCharMovie(QtGui.QLabel):
self.m_movie.stop()
self.m_movie.setFileName(gif_path)
self.m_movie.start()
elif self.use_pillow == 1: # apng
self.pillow_frames = images.load_apng(apng_path)
if len(self.pillow_frames) > 1: self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
if len(self.pillow_frames) > 1:
self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
self.set_pillow_frame()
elif self.use_pillow == 2: # webp
self.pillow_frames = images.load_webp(webp_path)
if len(self.pillow_frames) > 1: self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
if len(self.pillow_frames) > 1:
self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
self.set_pillow_frame()
self.show()
@ -469,6 +469,10 @@ class AOMovie(QtGui.QLabel):
self.pillow_timer.setSingleShot(True)
self.pillow_timer.timeout.connect(self.pillow_frame_change)
self.pillow_label = QtGui.QLabel(self)
self.pillow_label.setGeometry(0, 0, VIEWPORT_W, VIEWPORT_H)
self.pillow_label.hide()
def move(self, x, y):
self.xx = x
self.yy = y
@ -478,8 +482,6 @@ class AOMovie(QtGui.QLabel):
self.play_once = once
def play(self, p_image, p_char=""):
self.stop()
gif_path = p_image
pillow_modes = {".gif": 0, ".apng": 1, ".webp": 2}
@ -500,17 +502,22 @@ class AOMovie(QtGui.QLabel):
break
self.use_pillow = pillow_modes[os.path.splitext(gif_path)[1]]
if not self.use_pillow:
self.m_movie.setFileName(gif_path)
self.m_movie.start()
elif self.use_pillow == 1: # apng
self.pillow_label.show()
self.pillow_frames = images.load_apng(gif_path)
if len(self.pillow_frames) > 1: self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
if len(self.pillow_frames) > 1:
self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
self.set_pillow_frame()
elif self.use_pillow == 2: # webp
self.pillow_label.show()
self.pillow_loops = 0
self.pillow_frames, self.webp_loops = images.load_webp(gif_path)
if len(self.pillow_frames) > 1: self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
if len(self.pillow_frames) > 1:
self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
self.set_pillow_frame()
self.show()
@ -520,6 +527,8 @@ class AOMovie(QtGui.QLabel):
self.pillow_frame = 0
self.pillow_timer.stop()
self.m_movie.stop()
self.pillow_label.clear()
self.pillow_label.hide()
self.hide()
@QtCore.pyqtSlot(int)
@ -556,7 +565,7 @@ class AOMovie(QtGui.QLabel):
f_img = f_img.scaled(VIEWPORT_W, VIEWPORT_H, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)
f_pixmap = QtGui.QPixmap.fromImage(f_img)
self.setPixmap(f_pixmap)
self.pillow_label.setPixmap(f_pixmap)
class ZoomLines(QtGui.QLabel):
@ -1001,7 +1010,7 @@ class gui(QtGui.QWidget):
self.takethatbtn = buttons.Objections(self, 170+ 516 - 20, 312 + 40, 3)
self.objectbtn = buttons.Objections(self, 90+ 516 - 10, 312 + 40, 2)
self.holditbtn = buttons.Objections(self, 10+ 516, 312 + 40, 1)
self.objectsnd = None
self.objectsnd = 0
self.defensebar = buttons.PenaltyBars(self, 1)
self.prosecutionbar = buttons.PenaltyBars(self, 2)
self.defensebar.moveBar(265 + 164, 164 + 304)
@ -2421,6 +2430,11 @@ class gui(QtGui.QWidget):
audio.playhandle(self.realizationsnd, True)
def playObjectionSnd(self, charname, objection):
try:
charname = str(charname)
except:
print "WARNING: Can't play objection sound if charname is unicode yet"
if self.objectsnd:
if audio.handleisactive(self.objectsnd):
audio.stophandle(self.objectsnd)