aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstonedDiscord <Tukz@gmx.de>2021-09-24 16:12:21 +0200
committerstonedDiscord <Tukz@gmx.de>2021-09-24 16:12:21 +0200
commit5a23c935d97e3b0b22e9c3a6fc3a6b4681770b28 (patch)
tree0c4bc11517b21531ddfa6eda8ca049664f19563d
parent6a766503ebc678e54b17a7912ea8e8da269d0b33 (diff)
parent742856f3c8ab0e7bc70b2f21fe305c6b524414bb (diff)
Merge branch 'master' into fullsize-bg
-rw-r--r--webAO/client.html6
-rw-r--r--webAO/client.js51
-rw-r--r--webAO/styles/client.css4
3 files changed, 47 insertions, 14 deletions
diff --git a/webAO/client.html b/webAO/client.html
index 2dfa986..439abb4 100644
--- a/webAO/client.html
+++ b/webAO/client.html
@@ -424,13 +424,13 @@
onchange="changeMusicVolume()">
<p>SFX</p>
- <audio id="client_sfxaudio" onvolumechange="changeSFXVolume()" controls></audio>
+ <audio id="client_sfxaudio" onvolumechange="changeSFXVolume()" onerror="opusCheck()" controls></audio>
<p>Shouts</p>
- <audio id="client_shoutaudio" onvolumechange="changeShoutVolume()" controls></audio>
+ <audio id="client_shoutaudio" onvolumechange="changeShoutVolume()" onerror="opusCheck()" controls></audio>
<p>Testimony/Guilty</p>
- <audio id="client_testimonyaudio" onvolumechange="changeTestimonyVolume()" controls></audio>
+ <audio id="client_testimonyaudio" onvolumechange="changeTestimonyVolume()" onerror="opusCheck()" controls></audio>
<p>Blip</p>
<input id="client_bvolume" class="long" type="range" min="0" max="1" value="1" step="0.01"
diff --git a/webAO/client.js b/webAO/client.js
index 3453151..c12b97d 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -758,6 +758,7 @@ class Client extends EventEmitter {
const showname = args[3] || "";
const looping = Boolean(args[4]);
const channel = Number(args[5]) || 0;
+ // const fading = Number(args[6]) || 0; // unused in web
const music = viewport.music[channel];
let musicname;
@@ -1654,9 +1655,14 @@ class Viewport {
// Allocate multiple blip audio channels to make blips less jittery
- this.blipChannels = new Array(6);
- this.blipChannels.fill(new Audio(AO_HOST + "sounds/general/sfx-blipmale.opus"))
- .forEach(channel => channel.volume = 0.5);
+ this.blipChannels = new Array( new Audio(AO_HOST + "sounds/general/sfx-blipmale.opus"),
+ new Audio(AO_HOST + "sounds/general/sfx-blipmale.opus"),
+ new Audio(AO_HOST + "sounds/general/sfx-blipmale.opus"),
+ new Audio(AO_HOST + "sounds/general/sfx-blipmale.opus"),
+ new Audio(AO_HOST + "sounds/general/sfx-blipmale.opus"),
+ new Audio(AO_HOST + "sounds/general/sfx-blipmale.opus"));
+ this.blipChannels.forEach(channel => channel.volume = 0.5);
+ this.blipChannels.forEach(channel => channel.onerror = opusCheck(channel));
this.currentBlipChannel = 0;
this.sfxaudio = document.getElementById("client_sfxaudio");
@@ -1670,9 +1676,12 @@ class Viewport {
this.testimonyAudio = document.getElementById("client_testimonyaudio");
this.testimonyAudio.src = `${AO_HOST}sounds/general/sfx-guilty.opus`;
- this.music = new Array(3);
- this.music.fill(new Audio(`${AO_HOST}sounds/music/trial (aa).opus`))
- .forEach(channel => channel.volume = 0.5);
+ this.music = new Array( new Audio(`${AO_HOST}sounds/music/trial (aa).opus`),
+ new Audio(`${AO_HOST}sounds/music/trial (aa).opus`),
+ new Audio(`${AO_HOST}sounds/music/trial (aa).opus`),
+ new Audio(`${AO_HOST}sounds/music/trial (aa).opus`));
+ this.music.forEach(channel => channel.volume = 0.5);
+ this.music.forEach(channel => channel.onerror = opusCheck(channel));
this.updater = null;
this.testimonyUpdater = null;
@@ -2454,19 +2463,22 @@ export function onEnter(event) {
let sfxname = "0";
let sfxdelay = 0;
- let preanim = "-";
+ let emote_mod = myemo.zoom;
if (document.getElementById("sendsfx").checked) {
sfxname = myemo.sfx;
sfxdelay = myemo.sfxdelay;
}
+ // not to overwrite a 5 from the ini or anything else
if (document.getElementById("sendpreanim").checked) {
- preanim = myemo.preanim;
- }
+ if (emote_mod === 0)
+ emote_mod = 1;
+ } else if (emote_mod === 1)
+ emote_mod = 0;
- client.sendIC("chat", preanim, mychar.name, myemo.emote,
+ client.sendIC("chat", myemo.preanim, mychar.name, myemo.emote,
text, myrole,
- sfxname, myemo.zoom, sfxdelay, selectedShout, evi, flip,
+ sfxname, emote_mod, sfxdelay, selectedShout, evi, flip,
flash, color, showname, pairchar, pairoffset, pairyoffset, noninterrupting_preanim, looping_sfx, screenshake, "-", "-", "-", additive, effect);
}
}
@@ -2728,6 +2740,23 @@ export function imgError(image) {
window.imgError = imgError;
/**
+ * Triggered when there was an error loading a sound
+ * @param {HTMLImageElement} image the element containing the missing sound
+ */
+ export function opusCheck(channel) {
+ console.info(channel)
+ console.info("failed to load sound "+channel.src)
+ let oldsrc = ""
+ oldsrc = channel.src
+ if(!oldsrc.endsWith(".opus")) {
+ newsrc = oldsrc.replace(".mp3",".opus")
+ newsrc = newsrc.replace(".wav",".opus")
+ channel.src = newsrc; //unload so the old sprite doesn't persist
+ }
+}
+window.opusCheck = opusCheck;
+
+/**
* Make a GET request for a specific URI.
* @param {string} url the URI to be requested
* @returns response data
diff --git a/webAO/styles/client.css b/webAO/styles/client.css
index 080a6bb..de43993 100644
--- a/webAO/styles/client.css
+++ b/webAO/styles/client.css
@@ -591,6 +591,10 @@
background-color: rgb(54, 198, 68);
}
+.area- { /* THANKS CW */
+ background-color: rgb(54, 198, 68);
+}
+
.area-idle {
background-color: rgb(54, 198, 68);
}