diff --git a/nametag/src/flame.cpp b/nametag/src/flame.cpp index 07476f4..e91d519 100644 --- a/nametag/src/flame.cpp +++ b/nametag/src/flame.cpp @@ -1,6 +1,8 @@ #include "constants.h" #include "flame.h" +#include "overlay.h" + #define FLAME_PALETTE_SIZE 36 uint16_t flame_palette[] = { @@ -47,7 +49,8 @@ bool flame_ready = false; void spread_fire(int from) { int rand = random(1, 4); - int to = from - PANEL_WIDTH - rand + 1; + int rand_y = random(-1, 2); + int to = from - PANEL_WIDTH + rand_y; if (to < 0) { to = 0; } @@ -67,9 +70,9 @@ void do_fire() { void setup_flame() { memset(framebuffer, 0, sizeof framebuffer); - for (int i = 0; i < PANEL_WIDTH; i++) { - framebuffer[(PANEL_WIDTH * PANEL_HEIGHT - i - 1)] = FLAME_PALETTE_SIZE - 1; - } + //for (int i = 0; i < PANEL_WIDTH; i++) { + // framebuffer[(PANEL_WIDTH * PANEL_HEIGHT - i - 1)] = FLAME_PALETTE_SIZE - 1; + //} } void draw_flame(MatrixPanel_I2S_DMA *matrix, enum Mode mode) { @@ -77,9 +80,13 @@ void draw_flame(MatrixPanel_I2S_DMA *matrix, enum Mode mode) { setup_flame(); flame_ready = true; } - do_fire(); for(int p = 0; p < PANEL_HEIGHT * PANEL_WIDTH; p++) { + if (overlay[p / 8] & (1 << (7 - (p % 8))) and mode != Stealth) { + // offset the text + framebuffer[p + (6 * PANEL_WIDTH)] = FLAME_PALETTE_SIZE - 1; + } matrix->drawPixel(p % PANEL_WIDTH, p / PANEL_WIDTH, flame_palette[framebuffer[p]]); } + do_fire(); }