New colour settings, changeable flash colour #728
This commit is contained in:
@@ -7,28 +7,32 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
|
||||
* @param {number} mode Sets the intensity of the flash, used to recursively dim flash
|
||||
* All calls of function have use mode === 3
|
||||
* @param {string} config The setting in CM.Options that is checked before creating the flash
|
||||
* @param {bool} forced Whether the sound should play regardless of settings, used to test the sound
|
||||
*/
|
||||
export default function Flash(mode, config) {
|
||||
export default function Flash(mode, config, forced) {
|
||||
// The arguments check makes the sound not play upon initialization of the mod
|
||||
if (
|
||||
(CMOptions[config] === 1 && mode === 3 && isInitializing === false) ||
|
||||
((CMOptions[config] === 1 || forced) &&
|
||||
mode === 3 &&
|
||||
isInitializing === false) ||
|
||||
mode === 1
|
||||
) {
|
||||
l('CMWhiteScreen').style.opacity = '0.5';
|
||||
l('CMFlashScreen').style.backgroundColor = CMOptions[`Colour${config}`];
|
||||
l('CMFlashScreen').style.opacity = '0.5';
|
||||
if (mode === 3) {
|
||||
l('CMWhiteScreen').style.display = 'inline';
|
||||
l('CMFlashScreen').style.display = 'inline';
|
||||
setTimeout(function () {
|
||||
Flash(2, config);
|
||||
Flash(2, config, true);
|
||||
}, 1000 / Game.fps);
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
Flash(0, config);
|
||||
Flash(0, config, true);
|
||||
}, 1000 / Game.fps);
|
||||
}
|
||||
} else if (mode === 2) {
|
||||
l('CMWhiteScreen').style.opacity = '1';
|
||||
l('CMFlashScreen').style.opacity = '1';
|
||||
setTimeout(function () {
|
||||
Flash(1, config);
|
||||
Flash(1, config, true);
|
||||
}, 1000 / Game.fps);
|
||||
} else if (mode === 0) l('CMWhiteScreen').style.display = 'none';
|
||||
} else if (mode === 0) l('CMFlashScreen').style.display = 'none';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user