From ad2d1e6ca122cb9d87c6f18d9900caa490af97ef Mon Sep 17 00:00:00 2001
From: Minteck <nekostarfan@gmail.com>
Date: Fri, 11 Jun 2021 18:34:28 +0200
Subject: Music fixes (yes, after the game release)

---
 views/script/core_music.js | 7 +++++--
 views/script/game_music.js | 6 ++----
 2 files changed, 7 insertions(+), 6 deletions(-)

(limited to 'views/script')

diff --git a/views/script/core_music.js b/views/script/core_music.js
index 4b85ebb..a35d329 100644
--- a/views/script/core_music.js
+++ b/views/script/core_music.js
@@ -6,7 +6,10 @@ global.musicElement = new Audio();
 const musicIpc = require('electron').ipcRenderer;
 
 musicIpc.on('setmusic', (event, args) => {
-    if (!musicElement.paused) {
+    musicElement.src = args;
+    musicElement.play();
+    musicElement.volume = 1;
+    /*if (!musicElement.paused) {
         csi1 = setInterval(() => {
             if (musicElement.volume <= 0.05) {
                 clearInterval(csi1);
@@ -27,7 +30,7 @@ musicIpc.on('setmusic', (event, args) => {
     } else {
         musicElement.src = args;
         musicElement.play();
-    }
+    }*/
     /*try { csp1.volume = 0; } catch (e) {}
     try { csp2.volume = 0; } catch (e) {}
     song = args;
diff --git a/views/script/game_music.js b/views/script/game_music.js
index 29b00da..2aa7e94 100644
--- a/views/script/game_music.js
+++ b/views/script/game_music.js
@@ -1,8 +1,6 @@
 startHooks.push(() => {
-    if (require('@electron/remote').getCurrentWindow().music) {
-        info("MusicMgr", "Playing game" + i + ".mp3");
-        require('electron').ipcRenderer.send('newmusic', kresources.music['game' + i].file);
-    }
+    info("MusicMgr", "Playing game" + i + ".mp3");
+    require('electron').ipcRenderer.send('newmusic', kresources.music['game' + i].file);
 })
 
 if (location.search === "?online") {
-- 
cgit