buuuuurn bitch buuuhuhuhuuurnn

This commit is contained in:
Felix Pankratz 2024-12-27 17:19:07 +01:00
parent def486e7a7
commit 1e97ba3a95

View File

@ -1,6 +1,8 @@
#include "constants.h" #include "constants.h"
#include "flame.h" #include "flame.h"
#include "overlay.h"
#define FLAME_PALETTE_SIZE 36 #define FLAME_PALETTE_SIZE 36
uint16_t flame_palette[] = { uint16_t flame_palette[] = {
@ -47,7 +49,8 @@ bool flame_ready = false;
void spread_fire(int from) { void spread_fire(int from) {
int rand = random(1, 4); 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) { if (to < 0) {
to = 0; to = 0;
} }
@ -67,9 +70,9 @@ void do_fire() {
void setup_flame() { void setup_flame() {
memset(framebuffer, 0, sizeof framebuffer); memset(framebuffer, 0, sizeof framebuffer);
for (int i = 0; i < PANEL_WIDTH; i++) { //for (int i = 0; i < PANEL_WIDTH; i++) {
framebuffer[(PANEL_WIDTH * PANEL_HEIGHT - i - 1)] = FLAME_PALETTE_SIZE - 1; // framebuffer[(PANEL_WIDTH * PANEL_HEIGHT - i - 1)] = FLAME_PALETTE_SIZE - 1;
} //}
} }
void draw_flame(MatrixPanel_I2S_DMA *matrix, enum Mode mode) { 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(); setup_flame();
flame_ready = true; flame_ready = true;
} }
do_fire();
for(int p = 0; p < PANEL_HEIGHT * PANEL_WIDTH; p++) { 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]]); matrix->drawPixel(p % PANEL_WIDTH, p / PANEL_WIDTH, flame_palette[framebuffer[p]]);
} }
do_fire();
} }