diff --git a/dependencies/config/general.prc b/dependencies/config/general.prc index 52b24cb1..78a58f5a 100644 --- a/dependencies/config/general.prc +++ b/dependencies/config/general.prc @@ -5,7 +5,8 @@ icon-filename phase_3/etc/icon.ico cursor-filename phase_3/etc/toonmono.cur # Audio: -audio-library-name p3fmod_audio +audio-library-name p3openal_audio +video-library-name p3ffmpeg # Graphics: aux-display pandagl diff --git a/toontown/catalog/CatalogFurnitureItem.py b/toontown/catalog/CatalogFurnitureItem.py index ad630c23..18cc3515 100755 --- a/toontown/catalog/CatalogFurnitureItem.py +++ b/toontown/catalog/CatalogFurnitureItem.py @@ -1,6 +1,7 @@ +from direct.interval.IntervalGlobal import * import CatalogAtticItem import CatalogItem -import random +import random, glob from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals from panda3d.core import * @@ -1080,21 +1081,38 @@ class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem): if not scale == None: model.setScale(scale) model.flattenLight() - if self.furnitureType == 1530 and animate: - movie = loader.loadTexture('phase_5.5/movies/cheekyscrublords.avi') - self.sound = loader.loadSfx('phase_5.5/movies/cheekyscrublords.mp3') - movie.synchronizeTo(self.sound) - screen = NodePath(CardMaker('tv-screen').generate()) - screen.reparentTo(model) + if self.furnitureType == 1530 and animate: + screen = NodePath(CardMaker('tv-screen').generate()) + + model.find('**/toonTownBugTV_screen').hide() + screen.reparentTo(model) screen.setScale(2.5, 1.7, 1.4) screen.setPos(-1.15, -0.5, 1.1) - screen.setTexture(movie) - screen.setTexScale(TextureStage.getDefault(), movie.getTexScale()) - model.find('**/toonTownBugTV_screen').hide() - self.sound.setLoop(True) - self.sound.play() + self.startVideo(screen) + return model + + def startVideo(self, model, file=None): + files = glob.glob('user/videos/*.mp4') + + if not files: + model.setTextureOff(TextureStage.getDefault()) + model.setColor(0.3, 0.3, 0.3, 1.0) + return + + if file is None: + file = random.randint(0, len(files) - 1) + elif file >= len(files): + file = 0 + + movie = loader.loadTexture(files[file]) + sound = loader.loadSfx(files[file]) + movie.synchronizeTo(sound) + model.setTexture(movie) + model.setTexScale(TextureStage.getDefault(), movie.getTexScale()) + self.videoSequence = Sequence(SoundInterval(sound, node=model, listenerNode=base.localAvatar), Func(self.startVideo, model, file + 1)) + self.videoSequence.start() def decodeDatagram(self, di, versionNumber, store): CatalogAtticItem.CatalogAtticItem.decodeDatagram(self, di, versionNumber, store) diff --git a/toontown/estate/DistributedFurnitureItem.py b/toontown/estate/DistributedFurnitureItem.py index 79c8ec2d..75be8567 100755 --- a/toontown/estate/DistributedFurnitureItem.py +++ b/toontown/estate/DistributedFurnitureItem.py @@ -47,8 +47,8 @@ class DistributedFurnitureItem(DistributedHouseItem.DistributedHouseItem, Distri def delete(self): self.removeNode() - if hasattr(self.item, 'sound'): - self.item.sound.stop() + if hasattr(self.item, 'videoSequence') and self.item.videoSequence: + self.item.videoSequence.pause() del self.item DistributedHouseItem.DistributedHouseItem.delete(self) DistributedSmoothNode.DistributedSmoothNode.delete(self) diff --git a/user/videos/.gitignore b/user/videos/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/user/videos/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file