effect bugfixes for width>255

* band-aid for ripple, matrix, crazy bee
* arc mapping fix for diameter > 255
* small speedup for "block" mapping
This commit is contained in:
Frank
2024-11-13 23:57:53 +01:00
parent 202255849f
commit c73ed486e9
2 changed files with 18 additions and 15 deletions

View File

@@ -2589,7 +2589,7 @@ uint16_t ripple_base()
} else {//randomly create new wave
if (random16(IBN + 10000) <= (SEGMENT.intensity >> (SEGMENT.is2D()*3))) {
ripples[i].state = 1;
ripples[i].pos = SEGMENT.is2D() ? ((random8(SEGENV.virtualWidth())<<8) | (random8(SEGENV.virtualHeight()))) : random16(SEGLEN);
ripples[i].pos = SEGMENT.is2D() ? ((random16(SEGENV.virtualWidth())<<8) | (random16(SEGENV.virtualHeight()))) : random16(SEGLEN);
ripples[i].color = random8(); //color
}
}
@@ -5803,7 +5803,7 @@ uint16_t mode_2Dmatrix(void) { // Matrix2D. By Jeremy Williams.
// spawn new falling code
if (random8() <= SEGMENT.intensity || emptyScreen) {
uint8_t spawnX = random8(cols);
uint16_t spawnX = random16(cols);
SEGMENT.setPixelColorXY(spawnX, 0, spawnColor);
// update hint for next run
SEGENV.aux0 = spawnX;
@@ -6276,8 +6276,8 @@ uint16_t mode_2Dcrazybees(void) {
void aimed(uint_fast16_t w, uint_fast16_t h) {
if (!true) //WLEDMM SuperSync
random16_set_seed(strip.now);
aimX = random8(0, w);
aimY = random8(0, h);
aimX = random8(0, min(UINT8_MAX, int(w)));
aimY = random8(0, min(UINT8_MAX, int(h)));
hue = random8();
deltaX = abs(aimX - posX);
deltaY = abs(aimY - posY);
@@ -6296,8 +6296,8 @@ uint16_t mode_2Dcrazybees(void) {
SEGMENT.setUpLeds();
SEGMENT.fill(BLACK);
for (size_t i = 0; i < n; i++) {
bee[i].posX = random8(0, cols);
bee[i].posY = random8(0, rows);
bee[i].posX = random8(0, min(UINT8_MAX, int(cols)));
bee[i].posY = random8(0, min(UINT8_MAX, int(rows)));
bee[i].aimed(cols, rows);
}
}