diff --git a/animations/Makefile b/animations/Makefile index 8d4488c..1b7b4b8 100644 --- a/animations/Makefile +++ b/animations/Makefile @@ -53,8 +53,8 @@ ifeq ($(ANIMATION_LOGO_OOS),y) SRC += outofspec.c endif -ifeq ($(ANIMATION_LOGO_28C3),y) - SRC += 28c3.c +ifeq ($(ANIMATION_FAIRYDUST),y) + SRC += fairydust.c endif ifneq (,$(filter y,$(ANIMATION_PLASMA) $(ANIMATION_PSYCHEDELIC))) diff --git a/animations/config.in b/animations/config.in index cab52d8..106a3bd 100644 --- a/animations/config.in +++ b/animations/config.in @@ -53,7 +53,7 @@ comment "Animations" dep_bool "LABOR Logo" ANIMATION_LABORLOGO $ANIMATION_BMSCROLLER dep_bool "Amphibian" ANIMATION_AMPHIBIAN $ANIMATION_BMSCROLLER dep_bool "Out of Spec Logo" ANIMATION_LOGO_OOS $ANIMATION_BMSCROLLER - dep_bool "28c3 Logo" ANIMATION_LOGO_28C3 $ANIMATION_BMSCROLLER + dep_bool "Fairydust" ANIMATION_FAIRYDUST $ANIMATION_BMSCROLLER endmenu bool "Plasma" ANIMATION_PLASMA diff --git a/animations/28c3.c b/animations/fairydust.c similarity index 51% rename from animations/28c3.c rename to animations/fairydust.c index 0c80cdb..30ad1b4 100644 --- a/animations/28c3.c +++ b/animations/fairydust.c @@ -3,10 +3,16 @@ #include "../compat/pgmspace.h" #include "bitmapscroller.h" -#include "28c3.h" +#include "fairydust.h" +static uint8_t const nMargin = 5; /** margin above and below bitmap */ +static uint8_t const nRayStartOffset = 15; /** offset of the animated part */ +static uint8_t const nRayStopOffset = 25; /** last offset of that part */ -static uint8_t const a28c3Bitmap[2][30][9] PROGMEM = +/** + * complete bitmap of the fairy dust with a full ray + */ +static uint8_t const aFairydustBm[2][30][9] PROGMEM = {{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x0e, 0x00}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0xf0, 0x08, 0x80}, @@ -70,10 +76,102 @@ static uint8_t const a28c3Bitmap[2][30][9] PROGMEM = {0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00}}}; -static uint8_t const nMargin = 5; +/** + * Animated part of the bitmap (with different strengths of the ray) + */ +static uint8_t const aRay[2][44][4] PROGMEM = + {{{0x00, 0x00, 0x41, 0x7f}, // frame 1 + {0x00, 0x00, 0x02, 0xe1}, + {0x00, 0x00, 0x05, 0xa3}, + {0x00, 0x00, 0x1a, 0x00}, + {0x00, 0x00, 0x67, 0x41}, + {0x00, 0x01, 0x01, 0xf8}, + {0x00, 0x18, 0x1f, 0xeb}, + {0x00, 0x20, 0xe0, 0xf1}, + {0x00, 0x18, 0x00, 0x03}, + {0x00, 0x00, 0x00, 0x17}, + {0x00, 0x00, 0x00, 0x5f}, + {0x00, 0x00, 0x41, 0x7f}, // frame 2 + {0x00, 0x00, 0x02, 0xe1}, + {0x00, 0x00, 0x05, 0xa3}, + {0x00, 0x00, 0x1a, 0x00}, + {0x00, 0x00, 0x27, 0x41}, + {0x00, 0x00, 0x19, 0xf8}, + {0x00, 0x00, 0x07, 0xeb}, + {0x00, 0x00, 0x00, 0xf1}, + {0x00, 0x00, 0x00, 0x03}, + {0x00, 0x00, 0x00, 0x17}, + {0x00, 0x00, 0x00, 0x5f}, + {0x00, 0x00, 0x40, 0x8f}, // frame 3 + {0x00, 0x00, 0x01, 0x11}, + {0x00, 0x00, 0x02, 0x43}, + {0x00, 0x00, 0x04, 0x00}, + {0x00, 0x00, 0x08, 0x81}, + {0x00, 0x00, 0x06, 0x00}, + {0x00, 0x00, 0x00, 0x13}, + {0x00, 0x00, 0x00, 0x01}, + {0x00, 0x00, 0x00, 0x03}, + {0x00, 0x00, 0x00, 0x17}, + {0x00, 0x00, 0x00, 0x5f}, + {0x00, 0x00, 0x40, 0x0f}, // frame 4 + {0x00, 0x00, 0x00, 0x01}, + {0x00, 0x00, 0x00, 0x03}, + {0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x01}, + {0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x03}, + {0x00, 0x00, 0x00, 0x01}, + {0x00, 0x00, 0x00, 0x03}, + {0x00, 0x00, 0x00, 0x17}, + {0x00, 0x00, 0x00, 0x5f}}, + + {{0x00, 0x00, 0x00, 0xf3}, // frame 1 + {0x00, 0x00, 0x01, 0xf3}, + {0x00, 0x00, 0x02, 0x41}, + {0x00, 0x00, 0x04, 0x01}, + {0x00, 0x00, 0x18, 0x80}, + {0x00, 0x00, 0xff, 0xc1}, + {0x00, 0x07, 0xe0, 0xf1}, + {0x00, 0x1f, 0x00, 0x03}, + {0x00, 0x00, 0x00, 0x07}, + {0x00, 0x00, 0x00, 0x0f}, + {0x00, 0x00, 0x00, 0x3f}, + {0x00, 0x00, 0x00, 0xf3}, // frame 2 + {0x00, 0x00, 0x01, 0xf3}, + {0x00, 0x00, 0x02, 0x41}, + {0x00, 0x00, 0x04, 0x01}, + {0x00, 0x00, 0x18, 0x80}, + {0x00, 0x00, 0x07, 0xc1}, + {0x00, 0x00, 0x00, 0xf1}, + {0x00, 0x00, 0x00, 0x03}, + {0x00, 0x00, 0x00, 0x07}, + {0x00, 0x00, 0x00, 0x0f}, + {0x00, 0x00, 0x00, 0x3f}, + {0x00, 0x00, 0x00, 0x73}, // frame 3 + {0x00, 0x00, 0x00, 0xe3}, + {0x00, 0x00, 0x00, 0x01}, + {0x00, 0x00, 0x00, 0x01}, + {0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x01, 0xc1}, + {0x00, 0x00, 0x00, 0xe1}, + {0x00, 0x00, 0x00, 0x03}, + {0x00, 0x00, 0x00, 0x07}, + {0x00, 0x00, 0x00, 0x0f}, + {0x00, 0x00, 0x00, 0x3f}, + {0x00, 0x00, 0x00, 0x03}, // frame 4 + {0x00, 0x00, 0x00, 0x03}, + {0x00, 0x00, 0x00, 0x01}, + {0x00, 0x00, 0x00, 0x01}, + {0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x01}, + {0x00, 0x00, 0x00, 0x01}, + {0x00, 0x00, 0x00, 0x03}, + {0x00, 0x00, 0x00, 0x07}, + {0x00, 0x00, 0x00, 0x0f}, + {0x00, 0x00, 0x00, 0x3f}}}; -static uint8_t logo_28c3_getChunk(unsigned char const nBitPlane, +static uint8_t fairydust_getChunk(unsigned char const nBitPlane, unsigned char const nChunkX, unsigned char const nChunkY, unsigned int const nFrame) @@ -82,16 +180,30 @@ static uint8_t logo_28c3_getChunk(unsigned char const nBitPlane, assert(nChunkX < 9); assert(nChunkY < (nMargin + 30 + nMargin)); + static uint8_t const nOffsetTable[] PROGMEM = + {UINT8_MAX, 0, 11, 22, 33, 22, 11, 0}; + + uint8_t const nOffset = pgm_read_byte(&nOffsetTable[(nFrame >> 1) % 8]); + if (nChunkY < nMargin || nChunkY >= (nMargin + 30)) { return 0; } - return pgm_read_byte(&a28c3Bitmap[nBitPlane][nChunkY - nMargin][nChunkX]); + else if ((nChunkX <= 3) && + (nChunkY >= (nRayStartOffset + nMargin)) && + (nChunkY <= (nRayStopOffset + nMargin)) && + (nOffset != UINT8_MAX)) + { + uint8_t const row = nChunkY - nRayStartOffset - nMargin + nOffset; + return pgm_read_byte(&aRay[nBitPlane][row][nChunkX]); + } + + return pgm_read_byte(&aFairydustBm[nBitPlane][nChunkY - nMargin][nChunkX]); } -void logo_28c3() +void fairydust() { // width 72, height 30+x, 2 bitplanes (4 colors), 600 frames à 50ms (20 fps) - bitmap_scroll(72, nMargin + 30 + nMargin, 2, 600, 50, logo_28c3_getChunk); + bitmap_scroll(72, nMargin + 30 + nMargin, 2, 600, 50, fairydust_getChunk); } diff --git a/animations/28c3.h b/animations/fairydust.h similarity index 79% rename from animations/28c3.h rename to animations/fairydust.h index f83ef4c..708e8f3 100644 --- a/animations/28c3.h +++ b/animations/fairydust.h @@ -1,6 +1,6 @@ #ifndef LOGO_28C3_H_ #define LOGO_28C3_H_ -void logo_28c3(); +void fairydust(); #endif /* LOGO_28C3_H_ */ diff --git a/display_loop.c b/display_loop.c index 1aca977..10e23e4 100644 --- a/display_loop.c +++ b/display_loop.c @@ -15,7 +15,7 @@ #include "animations/amphibian.h" #include "animations/laborlogo.h" #include "animations/outofspec.h" -#include "animations/28c3.h" +#include "animations/fairydust.h" #include "animations/fpmath_patterns.h" #include "animations/mherweg.h" #include "animations/blackhole.h" @@ -209,9 +209,9 @@ void display_loop(){ break; #endif -#ifdef ANIMATION_LOGO_28C3 +#ifdef ANIMATION_FAIRYDUST case 20: - logo_28c3(); + fairydust(); break; #endif