Tetix & FX option bugfix.

- mono color with palette option
This commit is contained in:
Blaz Kristan 2022-12-08 17:17:54 +01:00
parent 3da2ec5112
commit 2c8dbb94fc
4 changed files with 1238 additions and 1229 deletions

View File

@ -3483,6 +3483,7 @@ uint16_t mode_tetrix(void) {
if (SEGENV.call == 0) { if (SEGENV.call == 0) {
drop->stack = 0; // reset brick stack size drop->stack = 0; // reset brick stack size
drop->step = 0; drop->step = 0;
if (SEGMENT.check1) drop->col = 0;// use only one color from palette
//for (int i=0; i<SEGLEN; i++) SEGMENT.setPixelColor(indexToVStrip(i, stripNr), SEGCOLOR(1)); // will fill virtual strip only //for (int i=0; i<SEGLEN; i++) SEGMENT.setPixelColor(indexToVStrip(i, stripNr), SEGCOLOR(1)); // will fill virtual strip only
} }
@ -3494,7 +3495,7 @@ uint16_t mode_tetrix(void) {
speed = map(speed, 1, 255, 5000, 250); // time taken for full (SEGLEN) drop speed = map(speed, 1, 255, 5000, 250); // time taken for full (SEGLEN) drop
drop->speed = float(SEGLEN * FRAMETIME) / float(speed); // set speed drop->speed = float(SEGLEN * FRAMETIME) / float(speed); // set speed
drop->pos = SEGLEN; // start at end of segment (no need to subtract 1) drop->pos = SEGLEN; // start at end of segment (no need to subtract 1)
drop->col = random8(0,15)<<4; // limit color choices so there is enough HUE gap if (!SEGMENT.check1) drop->col = random8(0,15)<<4; // limit color choices so there is enough HUE gap
drop->step = 1; // drop state (0 init, 1 forming, 2 falling) drop->step = 1; // drop state (0 init, 1 forming, 2 falling)
drop->brick = (SEGMENT.intensity ? (SEGMENT.intensity>>5)+1 : random8(1,5)) * (1+(SEGLEN>>6)); // size of brick drop->brick = (SEGMENT.intensity ? (SEGMENT.intensity>>5)+1 : random8(1,5)) * (1+(SEGLEN>>6)); // size of brick
} }
@ -3508,7 +3509,7 @@ uint16_t mode_tetrix(void) {
if (drop->step == 2) { // falling if (drop->step == 2) { // falling
if (drop->pos > drop->stack) { // fall until top of stack if (drop->pos > drop->stack) { // fall until top of stack
drop->pos -= drop->speed; // may add gravity as: speed += gravity drop->pos -= drop->speed; // may add gravity as: speed += gravity
if (uint16_t(drop->pos) < drop->stack) drop->pos = drop->stack; if (int(drop->pos) < int(drop->stack)) drop->pos = drop->stack;
for (int i=int(drop->pos); i<SEGLEN; i++) { for (int i=int(drop->pos); i<SEGLEN; i++) {
uint32_t col = i<int(drop->pos)+drop->brick ? SEGMENT.color_from_palette(drop->col, false, false, 0) : SEGCOLOR(1); uint32_t col = i<int(drop->pos)+drop->brick ? SEGMENT.color_from_palette(drop->col, false, false, 0) : SEGCOLOR(1);
SEGMENT.setPixelColor(indexToVStrip(i, stripNr), col); SEGMENT.setPixelColor(indexToVStrip(i, stripNr), col);
@ -3528,6 +3529,7 @@ uint16_t mode_tetrix(void) {
} else { } else {
drop->stack = 0; // reset brick stack size drop->stack = 0; // reset brick stack size
drop->step = 0; // proceed with next brick drop->step = 0; // proceed with next brick
if (SEGMENT.check1) drop->col += 8; // gradually increase palette index
} }
} }
} }
@ -3538,7 +3540,7 @@ uint16_t mode_tetrix(void) {
return FRAMETIME; return FRAMETIME;
} }
static const char _data_FX_MODE_TETRIX[] PROGMEM = "Tetrix@!,Width;!,!;!;;sx=0,ix=0,pal=11,m12=1"; static const char _data_FX_MODE_TETRIX[] PROGMEM = "Tetrix@!,Width,,,,One color;!,!;!;;sx=0,ix=0,pal=11,m12=1";
/* /*

View File

@ -286,15 +286,15 @@
</div> </div>
<div id="fxopt" class="option fade"> <div id="fxopt" class="option fade">
<label id="opt0" class="check ochkl hide"><i class="icons">&#xe2b3;</i><span class="tooltiptext" id="optLabel0">Check 1</span> <label id="opt0" class="check ochkl hide"><i class="icons">&#xe2b3;</i><span class="tooltiptext" id="optLabel0">Check 1</span>
<input type="checkbox" onchange="setOption(1, this.checked)"> <input id="checkO1" type="checkbox" onchange="setOption(1, this.checked)">
<span class="checkmark"></span> <span class="checkmark"></span>
</label> </label>
<label id="opt1" class="check ochkl hide"><i class="icons">&#xe34b;</i><span class="tooltiptext" id="optLabel1">Check 2</span> <label id="opt1" class="check ochkl hide"><i class="icons">&#xe34b;</i><span class="tooltiptext" id="optLabel1">Check 2</span>
<input type="checkbox" onchange="setOption(2, this.checked)"> <input id="checkO2" type="checkbox" onchange="setOption(2, this.checked)">
<span class="checkmark"></span> <span class="checkmark"></span>
</label> </label>
<label id="opt2" class="check ochkl hide"><i class="icons">&#xe04c;</i><span class="tooltiptext" id="optLabel2">Check 3</span> <label id="opt2" class="check ochkl hide"><i class="icons">&#xe04c;</i><span class="tooltiptext" id="optLabel2">Check 3</span>
<input type="checkbox" onchange="setOption(3, this.checked)"> <input id="checkO3" type="checkbox" onchange="setOption(3, this.checked)">
<span class="checkmark"></span> <span class="checkmark"></span>
</label> </label>
</div> </div>

View File

@ -1324,6 +1324,9 @@ function readState(s,command=false)
gId('sliderC1').value = i.c1 ? i.c1 : 0; gId('sliderC1').value = i.c1 ? i.c1 : 0;
gId('sliderC2').value = i.c2 ? i.c2 : 0; gId('sliderC2').value = i.c2 ? i.c2 : 0;
gId('sliderC3').value = i.c3 ? i.c3 : 0; gId('sliderC3').value = i.c3 ? i.c3 : 0;
gId('checkO1').checked = !(!i.o1);
gId('checkO2').checked = !(!i.o2);
gId('checkO3').checked = !(!i.o3);
if (s.error && s.error != 0) { if (s.error && s.error != 0) {
var errstr = ""; var errstr = "";

File diff suppressed because it is too large Load Diff