Skip to content

Commit

Permalink
Full SC-8850 letter display support for GS/SC.
Browse files Browse the repository at this point in the history
  • Loading branch information
PoneyClairDeLune committed Sep 24, 2024
1 parent e0be330 commit ab30e2a
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/disp/disp_sc8850.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ let Sc8850Display = class extends RootDisplay {
scLetterMode = timeNow < sum.letter.expire ? 1 : 0;
//console.debug(`SC constant: ${sum.letter.expire - timeNow}`);
} else {
let scLetterDuration = sum.letter.set + Math.min(18 + sum.letter.text.length, 50) * 300;
let scLetterDuration = sum.letter.set + Math.min(19 + sum.letter.text.length, 51) * 300;
scLetterMode = timeNow < scLetterDuration ? 2 : 0;
//console.debug(`SC variable: ${scLetterDuration - timeNow}`);
};
Expand Down Expand Up @@ -273,23 +273,31 @@ let Sc8850Display = class extends RootDisplay {
});
});
} else {
let displayText;
switch (scLetterMode) {
case 1: {
upThis.font7a.getStr(sum.letter.text).forEach((e0, i0) => {
let offsetX = i0 * 8;
e0.forEach((e1, i1) => {
let pX = (i1 % 11) + offsetX + 31, pY = Math.floor(i1 / 11);
if (e1) {
upThis.#nmdb[pY * totalWidth + pX] = 255;
};
});
});
displayText = sum.letter.text;
break;
};
case 2: {
let voiceNamePadded = upThis.getMapped(voiceObject.name).padEnd(12, " ");
displayText = ` ${voiceNamePadded}<${sum.letter.text}< ${voiceNamePadded}`;
let cutoffStart = (Math.floor((timeNow - sum.letter.set) / 300), );
displayText = displayText.substring(cutoffStart, cutoffStart + 16);
break;
};
};
if (scLetterMode != 0) {
upThis.font7a.getStr(displayText).forEach((e0, i0) => {
let offsetX = i0 * 8;
e0.forEach((e1, i1) => {
let pX = (i1 % 11) + offsetX + 31, pY = Math.floor(i1 / 11);
if (e1) {
upThis.#nmdb[pY * totalWidth + pX] = 255;
};
});
});
};
};
upThis.getChBm(upThis.#ch, voiceObject)?.render((e, x, y) => {
upThis.#nmdb[(y + 18) * totalWidth + x + 2] = e ? 255 : 0;
Expand Down

0 comments on commit ab30e2a

Please sign in to comment.