diff --git a/core/ansi_term.js b/core/ansi_term.js index 1bfb61a8..a135b023 100644 --- a/core/ansi_term.js +++ b/core/ansi_term.js @@ -51,6 +51,9 @@ var CONTROL = { goto : 'H', // row Pr, column Pc -- same as f gotoAlt : 'f', // same as H + blinkToBrightIntensity : '33h', + blinkNormal : '33l', + emulationSpeed : '*r' // Set output emulation speed. See cterm.txt }; diff --git a/core/art.js b/core/art.js index 399ff16e..c429c1da 100644 --- a/core/art.js +++ b/core/art.js @@ -173,6 +173,9 @@ function parseCharacterSAUCE(sauce) { result.fileType = SAUCE_CHARACTER_FILE_TYPES[sauce.fileType] || 'Unknown'; if(sauce.fileType === 0 || sauce.fileType === 1 || sauce.fileType === 2) { + // convience: create ansiFlags + sauce.ansiFlags = sauce.flags; + var i = 0; while(i < sauce.tinfos.length && sauce.tinfos[i] !== 0x00) { ++i; @@ -384,6 +387,7 @@ function display(options, cb) { var pauseKeys = miscUtil.valueWithDefault(options.pauseKeys, []); var pauseAtTermHeight = miscUtil.valueWithDefault(options.pauseAtTermHeight, false); var mciReplaceChar = miscUtil.valueWithDefault(options.mciReplaceChar, ' '); + var iceColors = miscUtil.valueWithDefault(options.iceColors, false); // :TODO: support pause/cancel & pause @ termHeight var canceled = false; @@ -414,6 +418,11 @@ function display(options, cb) { function completed() { options.client.removeListener('cursor position report', onCPR); parser.removeAllListeners(); // :TODO: Necessary??? + + if(iceColors) { + options.client.term.write(ansi.blinkNormal()); + } + cb(null, mci); } @@ -460,5 +469,9 @@ function display(options, cb) { } }); + if(iceColors) { + options.client.term.write(ansi.blinkToBrightIntensity()); + } + parser.parse(options.art); } \ No newline at end of file diff --git a/core/theme.js b/core/theme.js index ffe6b627..baf839f6 100644 --- a/core/theme.js +++ b/core/theme.js @@ -73,7 +73,7 @@ function initAvailableThemes(cb) { } function getRandomTheme(cb) { - if(availableThemes.length > 0) { + if(Object.getOwnPropertyNames(availableThemes).length > 0) { var themeIds = Object.keys(availableThemes); cb(null, themeIds[Math.floor(Math.random() * themeIds.length)]); } else { @@ -94,29 +94,37 @@ function getThemeArt(name, themeID, options, cb) { options.random = miscUtil.valueWithDefault(options.random, true); options.basePath = paths.join(Config.paths.themes, themeID); - art.getArt(name, options, function onThemeArt(err, theArt) { + art.getArt(name, options, function onThemeArt(err, artInfo) { if(err) { // try fallback of art directory options.basePath = Config.paths.art; - art.getArt(name, options, function onFallbackArt(err, theArt) { + art.getArt(name, options, function onFallbackArt(err, artInfo) { if(err) { cb(err); } else { - cb(null, theArt.data); + cb(null, artInfo); } }); } else { - cb(null, theArt.data); + cb(null, artInfo); } }); } function displayThemeArt(name, client, cb) { - getThemeArt(name, client.user.properties.art_theme_id, function onArt(err, theArt) { + getThemeArt(name, client.user.properties.art_theme_id, function onArt(err, artInfo) { if(err) { cb(err); } else { - art.display( { art : theArt, client : client }, function onDisplayed(err, mci) { + var iceColors = false; + if(artInfo.sauce && artInfo.sauce.ansiFlags) { + if(artInfo.sauce.ansiFlags & (1 << 0)) { + iceColors = true; + } + } + + console.log(artInfo.sauce.flags); + art.display( { art : artInfo.data, client : client, iceColors : iceColors }, function onDisplayed(err, mci) { cb(err, mci); }); } diff --git a/mods/art/themes/NU-MAYA/MATRIX.ANS b/mods/art/themes/NU-MAYA/MATRIX.ANS new file mode 100644 index 00000000..06030005 Binary files /dev/null and b/mods/art/themes/NU-MAYA/MATRIX.ANS differ diff --git a/mods/art/themes/NU-MAYA/theme_info.json b/mods/art/themes/NU-MAYA/theme_info.json new file mode 100644 index 00000000..75864b1c --- /dev/null +++ b/mods/art/themes/NU-MAYA/theme_info.json @@ -0,0 +1,4 @@ +{ + "name" : "Nu Mayan", + "author" : "NuSkooler" +} \ No newline at end of file diff --git a/mods/matrix.js b/mods/matrix.js index 837d9a66..5dbb587f 100644 --- a/mods/matrix.js +++ b/mods/matrix.js @@ -24,7 +24,11 @@ exports.entryPoint = entryPoint; function entryPoint(client) { + client.term.write(ansi.resetScreen()); + //client.term.write('\x1b[?33h'); + theme.displayThemeArt('MATRIX', client, function onMatrix(err, mciMap) { + console.log(mciMap); if(mciMap.ET1 && mciMap.ET2 && mciMap.BN1 && mciMap.BN2 && mciMap.BN3) { // // Form via EditTextViews and ButtonViews