diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/fire.c | 200 |
1 files changed, 97 insertions, 103 deletions
diff --git a/apps/plugins/fire.c b/apps/plugins/fire.c index 82770f3132..d161f577f5 100644 --- a/apps/plugins/fire.c +++ b/apps/plugins/fire.c | |||
@@ -31,12 +31,13 @@ PLUGIN_HEADER | |||
31 | /******************************* Globals ***********************************/ | 31 | /******************************* Globals ***********************************/ |
32 | 32 | ||
33 | static struct plugin_api* rb; /* global api struct pointer */ | 33 | static struct plugin_api* rb; /* global api struct pointer */ |
34 | static unsigned char *gbuf; | ||
35 | static unsigned int gbuf_size = 0; | ||
36 | 34 | ||
37 | static unsigned char fire[LCD_HEIGHT+3][LCD_WIDTH]; | 35 | static unsigned char fire[LCD_HEIGHT+3][LCD_WIDTH]; |
38 | static unsigned char cooling_map[LCD_HEIGHT][LCD_WIDTH]; | 36 | static unsigned char cooling_map[LCD_HEIGHT][LCD_WIDTH]; |
37 | |||
39 | #ifndef HAVE_LCD_COLOR | 38 | #ifndef HAVE_LCD_COLOR |
39 | static unsigned char *gbuf; | ||
40 | static unsigned int gbuf_size = 0; | ||
40 | static unsigned char draw_buffer[8*LCD_WIDTH]; | 41 | static unsigned char draw_buffer[8*LCD_WIDTH]; |
41 | #endif | 42 | #endif |
42 | 43 | ||
@@ -96,94 +97,93 @@ static unsigned char draw_buffer[8*LCD_WIDTH]; | |||
96 | #endif | 97 | #endif |
97 | 98 | ||
98 | #define MIN_FLAME_VALUE 0 | 99 | #define MIN_FLAME_VALUE 0 |
99 | #if LCD_HEIGHT > 64 | 100 | #define COOL_MAX (440/LCD_HEIGHT+2) |
100 | #define COOL_MAX 5 | 101 | |
101 | #else | 102 | /* fast unsigned multiplication (16x16bit->32bit or 32x32bit->32bit, |
102 | #define COOL_MAX 8 | 103 | * whichever is faster for the architecture) */ |
104 | #ifdef CPU_ARM | ||
105 | #define FMULU(a, b) ((uint32_t) (((uint32_t) (a)) * ((uint32_t) (b)))) | ||
106 | #else /* SH1, coldfire */ | ||
107 | #define FMULU(a, b) ((uint32_t) (((uint16_t) (a)) * ((uint16_t) (b)))) | ||
103 | #endif | 108 | #endif |
104 | 109 | ||
105 | /* unsigned 16 bit multiplication (a single instruction on the SH) */ | ||
106 | #define MULU16(a, b) ((unsigned long) \ | ||
107 | (((unsigned short) (a)) * ((unsigned short) (b)))) | ||
108 | |||
109 | #ifndef HAVE_LCD_COLOR | 110 | #ifndef HAVE_LCD_COLOR |
110 | static const unsigned char palette[255]= | 111 | static const unsigned char palette[256] = { |
111 | {/* logarithmic histogram equalisation */ | 112 | 0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 15, 16, 18, 19, 21, 22, |
112 | 113 | 24, 25, 27, 28, 30, 31, 33, 34, 36, 37, 39, 40, 42, 43, 45, 46, | |
113 | 0, 15, 31, 50, 63, 74, 82, 89, 95, 101, 105, 110, 114, 118, 121, | 114 | 48, 49, 51, 52, 54, 55, 57, 59, 60, 61, 63, 64, 66, 67, 69, 70, |
114 | 124, 127, 130, 133, 135, 137, 140, 142, 144, 146, 148, 149, 151, 153, 154, | 115 | 72, 73, 75, 76, 78, 79, 81, 82, 84, 85, 87, 88, 90, 91, 93, 94, |
115 | 156, 158, 159, 160, 162, 163, 164, 166, 167, 168, 169, 170, 172, 173, 174, | 116 | 96, 97, 99, 100, 102, 103, 105, 106, 108, 109, 111, 112, 114, 115, 117, 118, |
116 | 175, 176, 177, 178, 179, 180, 180, 181, 182, 183, 184, 185, 186, 186, 187, | 117 | 120, 121, 123, 124, 126, 127, 129, 130, 132, 133, 135, 136, 138, 139, 141, 142, |
117 | 188, 189, 189, 190, 191, 192, 192, 193, 194, 194, 195, 196, 196, 197, 198, | 118 | 144, 145, 147, 148, 150, 151, 153, 154, 156, 157, 159, 160, 162, 163, 165, 166, |
118 | 198, 199, 199, 200, 201, 201, 202, 202, 203, 203, 204, 204, 205, 206, 206, | 119 | 168, 169, 171, 172, 174, 175, 177, 178, 180, 181, 183, 184, 186, 187, 189, 190, |
119 | 207, 207, 208, 208, 209, 209, 210, 210, 210, 211, 211, 212, 212, 213, 213, | 120 | 192, 193, 195, 196, 198, 199, 201, 202, 204, 205, 207, 208, 210, 211, 213, 214, |
120 | 214, 214, 215, 215, 215, 216, 216, 217, 217, 217, 218, 218, 219, 219, 219, | 121 | 216, 217, 219, 220, 222, 223, 225, 226, 228, 229, 231, 232, 234, 235, 237, 238, |
121 | 220, 220, 221, 221, 221, 222, 222, 222, 223, 223, 223, 224, 224, 225, 225, | 122 | /* 'regular' fire doesn't exceed this value */ |
122 | 225, 226, 226, 226, 227, 227, 227, 228, 228, 228, 229, 229, 229, 229, 230, | 123 | 240, 240, 240, 240, 240, 240, 241, 241, 241, 241, 241, 241, 242, 242, 242, 242, |
123 | 230, 230, 231, 231, 231, 232, 232, 232, 232, 233, 233, 233, 234, 234, 234, | 124 | 242, 242, 243, 243, 243, 243, 243, 243, 244, 244, 244, 244, 244, 244, 245, 245, |
124 | 234, 235, 235, 235, 236, 236, 236, 236, 237, 237, 237, 237, 238, 238, 238, | 125 | 245, 245, 245, 245, 246, 246, 246, 246, 246, 246, 247, 247, 247, 247, 247, 247, |
125 | 238, 239, 239, 239, 239, 240, 240, 240, 240, 241, 241, 241, 241, 242, 242, | 126 | 248, 248, 248, 248, 248, 248, 249, 249, 249, 249, 249, 249, 250, 250, 250, 250, |
126 | 242, 242, 243, 243, 243, 243, 244, 244, 244, 244, 244, 245, 245, 245, 245, | 127 | 250, 250, 251, 251, 251, 251, 251, 251, 252, 252, 252, 252, 252, 252, 253, 253, |
127 | 246, 246, 246, 246, 246, 247, 247, 247, 247, 247, 248, 248, 248, 248, 249, | 128 | 253, 253, 253, 253, 254, 254, 254, 254, 254, 254, 255, 255, 255, 255, 255, 255 |
128 | 249, 249, 249, 249, 250, 250, 250, 250, 250, 251, 251, 251, 251, 251, 252, | ||
129 | 252, 252, 252, 252, 252, 253, 253, 253, 253, 253, 254, 254, 254, 254, 254 | ||
130 | }; | 129 | }; |
131 | #else | 130 | #else |
132 | #define L(r,g,b) LCD_RGBPACK(r,g,b) | 131 | #define L(r,g,b) LCD_RGBPACK(r,g,b) |
133 | 132 | ||
134 | static const fb_data colorpalette[256] = { | 133 | static const fb_data colorpalette[256] = { |
135 | L(248,246,211), L(248,246,203), L(248,245,196), L(248,245,189), L(247,245,182), | 134 | L( 0, 0, 0), L( 5, 0, 0), L( 10, 0, 0), L( 15, 0, 0), L( 20, 0, 0), |
136 | L(248,245,174), L(248,244,167), L(248,244,160), L(248,243,153), L(247,243,145), | 135 | L( 25, 0, 0), L( 30, 0, 0), L( 35, 0, 0), L( 40, 0, 0), L( 45, 0, 0), |
137 | L(248,243,138), L(247,243,131), L(247,243,125), L(248,242,117), L(248,242,110), | 136 | L( 50, 0, 0), L( 55, 0, 0), L( 60, 0, 0), L( 65, 0, 0), L( 70, 0, 0), |
138 | L(247,242,102), L(248,241, 94), L(247,240, 85), L(247,241, 78), L(248,240, 70), | 137 | L( 75, 0, 0), L( 80, 0, 0), L( 85, 0, 0), L( 90, 0, 0), L( 95, 0, 0), |
139 | L(247,239, 63), L(247,240, 55), L(247,239, 47), L(247,239, 39), L(247,238, 31), | 138 | L(100, 0, 0), L(105, 0, 0), L(110, 0, 0), L(115, 0, 0), L(120, 0, 0), |
140 | L(247,238, 23), L(247,236, 19), L(248,232, 21), L(248,228, 22), L(248,224, 23), | 139 | L(125, 0, 0), L(130, 0, 0), L(135, 0, 0), L(140, 0, 0), L(145, 0, 0), |
141 | L(248,219, 25), L(249,215, 26), L(249,211, 27), L(249,206, 29), L(249,203, 30), | 140 | L(150, 0, 0), L(155, 0, 0), L(160, 0, 0), L(165, 0, 0), L(170, 0, 0), |
142 | L(249,199, 31), L(250,194, 33), L(250,190, 34), L(251,186, 35), L(251,181, 37), | 141 | L(175, 0, 0), L(180, 0, 0), L(185, 0, 0), L(186, 2, 0), L(187, 5, 1), |
143 | L(252,177, 38), L(251,172, 40), L(252,168, 41), L(252,163, 42), L(253,158, 44), | 142 | L(188, 6, 2), L(189, 8, 3), L(190, 10, 4), L(191, 12, 4), L(192, 14, 5), |
144 | L(253,154, 45), L(253,149, 46), L(254,145, 48), L(253,141, 50), L(253,137, 49), | 143 | L(193, 15, 6), L(194, 17, 7), L(195, 19, 8), L(196, 21, 8), L(197, 22, 9), |
145 | L(253,135, 49), L(252,133, 48), L(251,130, 47), L(249,129, 47), L(248,128, 46), | 144 | L(198, 24, 10), L(198, 26, 10), L(199, 28, 10), L(200, 29, 11), L(201, 32, 11), |
146 | L(247,125, 46), L(247,124, 44), L(246,122, 44), L(244,119, 43), L(243,118, 43), | 145 | L(202, 34, 12), L(203, 36, 13), L(204, 39, 13), L(205, 40, 14), L(206, 42, 14), |
147 | L(242,115, 42), L(242,113, 41), L(241,112, 40), L(240,109, 39), L(238,107, 39), | 146 | L(207, 43, 15), L(208, 46, 16), L(208, 48, 17), L(209, 50, 18), L(210, 51, 18), |
148 | L(237,105, 38), L(236,103, 37), L(235,101, 37), L(234, 99, 36), L(233, 97, 35), | 147 | L(212, 53, 19), L(213, 55, 20), L(214, 57, 21), L(215, 59, 22), L(216, 61, 22), |
149 | L(232, 95, 34), L(231, 93, 33), L(230, 91, 32), L(229, 89, 32), L(228, 86, 31), | 148 | L(217, 63, 23), L(217, 65, 24), L(218, 67, 24), L(219, 69, 25), L(220, 70, 25), |
150 | L(227, 85, 30), L(226, 82, 29), L(225, 80, 29), L(224, 78, 28), L(223, 76, 28), | 149 | L(222, 72, 26), L(223, 74, 27), L(224, 76, 28), L(225, 78, 28), L(225, 80, 29), |
151 | L(222, 74, 26), L(221, 72, 26), L(220, 69, 25), L(218, 67, 24), L(217, 64, 23), | 150 | L(226, 82, 29), L(227, 84, 30), L(228, 86, 31), L(228, 88, 32), L(229, 90, 32), |
152 | L(215, 60, 22), L(213, 57, 21), L(212, 54, 19), L(210, 50, 18), L(208, 47, 17), | 151 | L(230, 92, 32), L(231, 94, 33), L(232, 96, 34), L(233, 98, 35), L(234, 99, 36), |
153 | L(207, 44, 16), L(205, 41, 14), L(203, 37, 13), L(202, 34, 12), L(201, 30, 11), | 152 | L(235,101, 37), L(236,103, 37), L(237,105, 38), L(238,107, 39), L(240,109, 39), |
154 | L(199, 27, 10), L(197, 24, 9), L(196, 21, 8), L(194, 18, 7), L(192, 14, 5), | 153 | L(240,111, 40), L(241,113, 40), L(242,114, 41), L(242,116, 42), L(243,119, 43), |
155 | L(191, 11, 4), L(189, 8, 3), L(187, 5, 1), L(186, 2, 0), L(184, 0, 0), | 154 | L(245,120, 43), L(246,122, 44), L(247,124, 44), L(248,126, 46), L(248,128, 47), |
156 | L(181, 0, 0), L(178, 0, 0), L(175, 0, 0), L(172, 0, 0), L(170, 0, 0), | 155 | L(249,130, 47), L(251,131, 47), L(252,133, 48), L(253,135, 49), L(253,138, 49), |
157 | L(167, 0, 0), L(165, 0, 0), L(162, 0, 0), L(159, 0, 0), L(156, 0, 0), | 156 | L(253,140, 50), L(254,143, 49), L(254,145, 48), L(253,148, 47), L(253,151, 46), |
158 | L(153, 0, 0), L(152, 0, 0), L(149, 0, 0), L(146, 0, 0), L(143, 0, 0), | 157 | L(253,154, 45), L(253,156, 44), L(253,158, 44), L(252,162, 42), L(252,165, 41), |
159 | L(141, 0, 0), L(138, 0, 0), L(135, 0, 0), L(132, 0, 0), L(129, 0, 0), | 158 | L(252,167, 41), L(252,170, 40), L(251,173, 40), L(252,175, 38), L(252,178, 37), |
160 | L(127, 0, 0), L(126, 0, 0), L(123, 0, 0), L(120, 0, 0), L(117, 0, 0), | 159 | L(251,181, 37), L(251,183, 36), L(251,186, 35), L(250,189, 34), L(250,192, 33), |
161 | L(115, 0, 0), L(112, 0, 0), L(109, 0, 0), L(106, 0, 0), L(104, 0, 0), | 160 | L(250,194, 33), L(249,198, 31), L(249,200, 31), L(249,203, 30), L(249,206, 29), |
162 | L(101, 0, 0), L( 98, 0, 0), L( 95, 0, 0), L( 93, 0, 0), L( 92, 0, 0), | 161 | L(249,209, 28), L(249,211, 27), L(249,214, 26), L(248,216, 25), L(248,219, 25), |
163 | L( 91, 0, 0), L( 91, 0, 0), L( 90, 0, 0), L( 89, 0, 0), L( 88, 0, 0), | 162 | L(248,222, 24), L(248,224, 23), L(248,227, 22), L(248,230, 21), L(248,232, 21), |
164 | L( 88, 0, 0), L( 87, 0, 0), L( 86, 0, 0), L( 85, 0, 0), L( 84, 0, 0), | 163 | L(247,236, 19), L(247,238, 23), L(247,239, 31), L(247,239, 45), L(247,240, 55), |
165 | L( 84, 0, 0), L( 82, 0, 0), L( 82, 0, 0), L( 81, 0, 0), L( 80, 0, 0), | 164 | L(248,240, 68), L(247,241, 78), L(248,241, 90), L(247,242,102), L(248,242,114), |
166 | L( 80, 0, 0), L( 79, 0, 0), L( 78, 0, 0), L( 77, 0, 0), L( 76, 0, 0), | 165 | L(247,243,125), L(248,243,138), L(248,243,153), L(248,244,162), L(248,245,174), |
167 | L( 76, 0, 0), L( 75, 0, 0), L( 74, 0, 0), L( 73, 0, 0), L( 72, 0, 0), | 166 | /* 'regular' fire doesn't exceed this value */ |
168 | L( 72, 0, 0), L( 71, 0, 0), L( 70, 0, 0), L( 69, 0, 0), L( 68, 0, 0), | 167 | L(247,245,182), L(247,245,182), L(247,245,183), L(247,245,183), L(247,245,184), |
169 | L( 68, 0, 0), L( 67, 0, 0), L( 66, 0, 0), L( 65, 0, 0), L( 65, 0, 0), | 168 | L(247,245,184), L(247,245,185), L(247,245,185), L(247,245,186), L(247,245,186), |
170 | L( 63, 0, 0), L( 62, 0, 0), L( 62, 0, 0), L( 61, 0, 0), L( 60, 0, 0), | 169 | L(247,245,187), L(247,245,187), L(247,245,188), L(247,245,188), L(247,245,189), |
171 | L( 59, 0, 0), L( 58, 0, 0), L( 58, 0, 0), L( 58, 0, 0), L( 57, 0, 0), | 170 | L(247,245,189), L(248,245,190), L(248,245,190), L(248,245,191), L(248,245,191), |
172 | L( 56, 0, 0), L( 54, 0, 0), L( 54, 0, 0), L( 53, 0, 0), L( 52, 0, 0), | 171 | L(248,245,192), L(248,245,192), L(248,245,193), L(248,245,193), L(248,245,194), |
173 | L( 52, 0, 0), L( 51, 0, 0), L( 50, 0, 0), L( 49, 0, 0), L( 48, 0, 0), | 172 | L(248,245,194), L(248,245,195), L(248,245,195), L(248,245,196), L(248,245,196), |
174 | L( 47, 0, 0), L( 47, 0, 0), L( 46, 0, 0), L( 45, 0, 0), L( 44, 0, 0), | 173 | L(248,245,197), L(248,245,197), L(248,245,198), L(248,245,198), L(248,245,199), |
175 | L( 44, 0, 0), L( 43, 0, 0), L( 42, 0, 0), L( 42, 0, 0), L( 40, 0, 0), | 174 | L(248,245,199), L(248,245,200), L(248,245,200), L(248,245,201), L(248,245,201), |
176 | L( 40, 0, 0), L( 39, 0, 0), L( 38, 0, 0), L( 38, 0, 0), L( 37, 0, 0), | 175 | L(248,245,202), L(248,245,202), L(248,245,203), L(248,245,203), L(248,245,204), |
177 | L( 36, 0, 0), L( 35, 0, 0), L( 34, 0, 0), L( 33, 0, 0), L( 32, 0, 0), | 176 | L(248,245,204), L(248,245,205), L(248,245,205), L(248,246,206), L(248,246,206), |
178 | L( 32, 0, 0), L( 31, 0, 0), L( 30, 0, 0), L( 30, 0, 0), L( 28, 0, 0), | 177 | L(248,246,207), L(248,246,207), L(248,246,208), L(248,246,208), L(248,246,209), |
179 | L( 28, 0, 0), L( 27, 0, 0), L( 26, 0, 0), L( 25, 0, 0), L( 25, 0, 0), | 178 | L(248,246,209), L(248,246,210), L(248,246,210), L(248,246,211), L(248,246,211), |
180 | L( 23, 0, 0), L( 23, 0, 0), L( 22, 0, 0), L( 21, 0, 0), L( 21, 0, 0), | 179 | L(248,246,212), L(248,246,212), L(248,246,213), L(248,246,213), L(248,246,214), |
181 | L( 20, 0, 0), L( 19, 0, 0), L( 18, 0, 0), L( 18, 0, 0), L( 16, 0, 0), | 180 | L(248,246,214), L(248,246,215), L(248,246,215), L(248,246,216), L(248,246,216), |
182 | L( 16, 0, 0), L( 15, 0, 0), L( 14, 0, 0), L( 14, 0, 0), L( 13, 0, 0), | 181 | L(248,246,217), L(248,246,217), L(248,246,218), L(248,246,218), L(248,246,219), |
183 | L( 12, 0, 0), L( 11, 0, 0), L( 10, 0, 0), L( 9, 0, 0), L( 9, 0, 0), | 182 | L(248,246,219), L(248,246,220), L(248,246,220), L(248,246,221), L(248,246,221), |
184 | L( 8, 0, 0), L( 7, 0, 0), L( 6, 0, 0), L( 5, 0, 0), L( 5, 0, 0), | 183 | L(248,246,222), L(248,246,222), L(248,246,223), L(248,246,223), L(248,246,224), |
185 | L( 4, 0, 0), L( 3, 0, 0), L( 3, 0, 0), L( 2, 0, 0), L( 1, 0, 0), | 184 | L(248,246,224), L(248,246,225), L(248,246,225), L(248,246,226), L(248,246,226), |
186 | L( 0, 0, 0) | 185 | L(248,246,227), L(248,246,227), L(248,246,228), L(248,246,228), L(248,246,229), |
186 | L(248,246,229) | ||
187 | }; | 187 | }; |
188 | #endif | 188 | #endif |
189 | 189 | ||
@@ -230,7 +230,7 @@ static inline void fire_generate(int mult, int flames_type, bool moving) | |||
230 | + ptr[2*LCD_WIDTH] /* fire[y+2][x] */ | 230 | + ptr[2*LCD_WIDTH] /* fire[y+2][x] */ |
231 | + ptr[LCD_WIDTH+1] /* fire[y+1][x+1] */ | 231 | + ptr[LCD_WIDTH+1] /* fire[y+1][x+1] */ |
232 | + ptr[3*LCD_WIDTH]; /* fire[y+3][x] */ | 232 | + ptr[3*LCD_WIDTH]; /* fire[y+3][x] */ |
233 | pixel_value = MULU16(pixel_value, mult) >> 10; | 233 | pixel_value = FMULU(pixel_value, mult) >> 10; |
234 | 234 | ||
235 | cooling_value = *cool++; | 235 | cooling_value = *cool++; |
236 | if (cooling_value <= pixel_value) | 236 | if (cooling_value <= pixel_value) |
@@ -246,13 +246,14 @@ static inline void fire_generate(int mult, int flames_type, bool moving) | |||
246 | break; | 246 | break; |
247 | 247 | ||
248 | case 1: | 248 | case 1: |
249 | mult -= 2; | ||
249 | do | 250 | do |
250 | { | 251 | { |
251 | pixel_value = ptr[LCD_WIDTH-1] /* fire[y+1][x-1] */ | 252 | pixel_value = ptr[LCD_WIDTH-1] /* fire[y+1][x-1] */ |
252 | + ptr[LCD_WIDTH] /* fire[y+1][x] */ | 253 | + ptr[LCD_WIDTH] /* fire[y+1][x] */ |
253 | + ptr[LCD_WIDTH+1] /* fire[y+1][x+1] */ | 254 | + ptr[LCD_WIDTH+1] /* fire[y+1][x+1] */ |
254 | + ptr[2*LCD_WIDTH]; /* fire[y+2][x] */ | 255 | + ptr[2*LCD_WIDTH]; /* fire[y+2][x] */ |
255 | pixel_value = MULU16(pixel_value, mult) >> 10; | 256 | pixel_value = FMULU(pixel_value, mult) >> 10; |
256 | 257 | ||
257 | cooling_value = *cool++; | 258 | cooling_value = *cool++; |
258 | if (cooling_value <= pixel_value) | 259 | if (cooling_value <= pixel_value) |
@@ -296,10 +297,10 @@ static inline void fire_draw(void) | |||
296 | fb_data* end = rb->lcd_framebuffer+(LCD_WIDTH*LCD_HEIGHT); | 297 | fb_data* end = rb->lcd_framebuffer+(LCD_WIDTH*LCD_HEIGHT); |
297 | unsigned char* src = &fire[0][0]; | 298 | unsigned char* src = &fire[0][0]; |
298 | 299 | ||
299 | while (dest < end) | 300 | do |
300 | { | 301 | *dest++ = colorpalette[*src++]; |
301 | *(dest++) = colorpalette[*(src++)]; | 302 | while (dest < end); |
302 | } | 303 | |
303 | rb->lcd_update(); | 304 | rb->lcd_update(); |
304 | #endif | 305 | #endif |
305 | } | 306 | } |
@@ -324,36 +325,29 @@ void cleanup(void *parameter) | |||
324 | 325 | ||
325 | int main(void) | 326 | int main(void) |
326 | { | 327 | { |
327 | int shades, button; | 328 | int button; |
328 | #ifdef HAVE_LCD_COLOR | ||
329 | int mult = 267; | ||
330 | #else | ||
331 | int mult = 261; | 329 | int mult = 261; |
332 | #endif | ||
333 | int flames_type=0; | 330 | int flames_type=0; |
334 | bool moving=true; | 331 | bool moving=true; |
332 | #ifndef HAVE_LCD_COLOR | ||
333 | int shades; | ||
334 | |||
335 | /* get the remainder of the plugin buffer */ | 335 | /* get the remainder of the plugin buffer */ |
336 | gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size); | 336 | gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size); |
337 | |||
338 | #ifdef HAVE_LCD_COLOR | ||
339 | shades = 256; | ||
340 | #else | ||
341 | shades = gray_init(rb, gbuf, gbuf_size, false, LCD_WIDTH, LCD_HEIGHT, | 337 | shades = gray_init(rb, gbuf, gbuf_size, false, LCD_WIDTH, LCD_HEIGHT, |
342 | 32, 2<<8, NULL) + 1; | 338 | 32, 1<<8, NULL) + 1; |
343 | if(shades <= 1) | 339 | if(shades <= 1) |
344 | { | 340 | { |
345 | rb->splash(HZ, true, "not enough memory"); | 341 | rb->splash(HZ, true, "not enough memory"); |
346 | return PLUGIN_ERROR; | 342 | return PLUGIN_ERROR; |
347 | } | 343 | } |
344 | /* switch on grayscale overlay */ | ||
345 | gray_show(true); | ||
348 | #endif | 346 | #endif |
349 | 347 | ||
350 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 348 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
351 | rb->cpu_boost(true); | 349 | rb->cpu_boost(true); |
352 | #endif | 350 | #endif |
353 | #ifndef HAVE_LCD_COLOR | ||
354 | /* switch on grayscale overlay */ | ||
355 | gray_show(true); | ||
356 | #endif | ||
357 | rb->memset(&fire[0][0], 0, sizeof(fire)); | 351 | rb->memset(&fire[0][0], 0, sizeof(fire)); |
358 | tab_init_rand(&cooling_map[0][0], LCD_HEIGHT*LCD_WIDTH, COOL_MAX); | 352 | tab_init_rand(&cooling_map[0][0], LCD_HEIGHT*LCD_WIDTH, COOL_MAX); |
359 | while (true) | 353 | while (true) |
@@ -369,7 +363,7 @@ int main(void) | |||
369 | #ifdef FIRE_RC_QUIT | 363 | #ifdef FIRE_RC_QUIT |
370 | case FIRE_RC_QUIT : | 364 | case FIRE_RC_QUIT : |
371 | #endif | 365 | #endif |
372 | case(FIRE_QUIT): | 366 | case (FIRE_QUIT): |
373 | cleanup(NULL); | 367 | cleanup(NULL); |
374 | return PLUGIN_OK; | 368 | return PLUGIN_OK; |
375 | break; | 369 | break; |