summaryrefslogtreecommitdiff
path: root/apps/plugins/brickmania.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2006-01-26 23:31:00 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2006-01-26 23:31:00 +0000
commit3325d9915451bac9554217fce9e4d3c7529d91e2 (patch)
tree321c71196fb818eb599efbe79a09a1c6c3069c79 /apps/plugins/brickmania.c
parentea8bbe3df678d6007bf4ae693fba7c05ec41b79c (diff)
downloadrockbox-3325d9915451bac9554217fce9e4d3c7529d91e2.tar.gz
rockbox-3325d9915451bac9554217fce9e4d3c7529d91e2.zip
Patch #1415757 by Ben Basha - Brickmania update, Flip powerup plus some bricks need several hits to break
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8461 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/brickmania.c')
-rw-r--r--apps/plugins/brickmania.c229
1 files changed, 144 insertions, 85 deletions
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c
index 3e16cd6505..56b29d5871 100644
--- a/apps/plugins/brickmania.c
+++ b/apps/plugins/brickmania.c
@@ -113,7 +113,7 @@ extern const fb_data brickmania_bricks[];
113#endif 113#endif
114 114
115int levels_num = 29; 115int levels_num = 29;
116 116
117static unsigned char levels[29][8][10] = { 117static unsigned char levels[29][8][10] = {
118 { /* level1 */ 118 { /* level1 */
119 {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1}, 119 {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1},
@@ -137,20 +137,20 @@ static unsigned char levels[29][8][10] = {
137 }, 137 },
138 { /* level3 */ 138 { /* level3 */
139 {0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2}, 139 {0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2},
140 {0x3,0x23,0x23,0x3,0x0,0x0,0x2,0x22,0x22,0x2},
140 {0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2}, 141 {0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2},
141 {0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2}, 142 {0x0,0x0,0x0,0x0,0x37,0x37,0x0,0x0,0x0,0x0},
142 {0x0,0x0,0x0,0x0,0x7,0x7,0x0,0x0,0x0,0x0}, 143 {0x0,0x0,0x0,0x0,0x37,0x37,0x0,0x0,0x0,0x0},
143 {0x0,0x0,0x0,0x0,0x7,0x7,0x0,0x0,0x0,0x0},
144 {0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6},
145 {0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6}, 144 {0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6},
145 {0x5,0x25,0x25,0x5,0x0,0x0,0x6,0x26,0x26,0x6},
146 {0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6} 146 {0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6}
147 }, 147 },
148 { /* level4 */ 148 { /* level4 */
149 {0x0,0x0,0x0,0x7,0x7,0x7,0x7,0x0,0x0,0x0}, 149 {0x0,0x0,0x0,0x27,0x27,0x27,0x27,0x0,0x0,0x0},
150 {0x0,0x0,0x0,0x7,0x7,0x7,0x7,0x0,0x0,0x0}, 150 {0x0,0x0,0x0,0x27,0x7,0x7,0x27,0x0,0x0,0x0},
151 {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2}, 151 {0x22,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x22},
152 {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2}, 152 {0x22,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x22},
153 {0x6,0x6,0x0,0x2,0x2,0x2,0x2,0x0,0x6,0x6}, 153 {0x26,0x6,0x0,0x2,0x2,0x2,0x2,0x0,0x6,0x26},
154 {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0}, 154 {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0},
155 {0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x0}, 155 {0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x0},
156 {0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x1,0x1,0x1} 156 {0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x1,0x1,0x1}
@@ -160,10 +160,10 @@ static unsigned char levels[29][8][10] = {
160 {0x0,0x2,0x2,0x0,0x3,0x3,0x0,0x4,0x4,0x0}, 160 {0x0,0x2,0x2,0x0,0x3,0x3,0x0,0x4,0x4,0x0},
161 {0x2,0x2,0x0,0x3,0x3,0x0,0x4,0x4,0x0,0x5}, 161 {0x2,0x2,0x0,0x3,0x3,0x0,0x4,0x4,0x0,0x5},
162 {0x2,0x0,0x3,0x3,0x0,0x4,0x4,0x0,0x5,0x5}, 162 {0x2,0x0,0x3,0x3,0x0,0x4,0x4,0x0,0x5,0x5},
163 {0x0,0x3,0x3,0x0,0x4,0x4,0x0,0x5,0x5,0x0}, 163 {0x0,0x33,0x3,0x0,0x4,0x4,0x0,0x5,0x5,0x0},
164 {0x3,0x3,0x0,0x4,0x4,0x0,0x5,0x5,0x0,0x6}, 164 {0x3,0x33,0x0,0x4,0x4,0x0,0x5,0x5,0x0,0x36},
165 {0x3,0x0,0x4,0x4,0x0,0x5,0x5,0x0,0x6,0x6}, 165 {0x3,0x0,0x4,0x4,0x0,0x5,0x5,0x0,0x6,0x36},
166 {0x0,0x4,0x4,0x0,0x5,0x5,0x0,0x6,0x6,0x0} 166 {0x0,0x24,0x24,0x0,0x25,0x25,0x0,0x26,0x26,0x0}
167 }, 167 },
168 { /* level6 */ 168 { /* level6 */
169 {0x0,0x1,0x3,0x7,0x7,0x7,0x7,0x3,0x1,0x0}, 169 {0x0,0x1,0x3,0x7,0x7,0x7,0x7,0x3,0x1,0x0},
@@ -188,12 +188,12 @@ static unsigned char levels[29][8][10] = {
188 { /* level8 */ 188 { /* level8 */
189 {0x0,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x0}, 189 {0x0,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x0},
190 {0x0,0x0,0x0,0x4,0x0,0x0,0x4,0x0,0x0,0x0}, 190 {0x0,0x0,0x0,0x4,0x0,0x0,0x4,0x0,0x0,0x0},
191 {0x6,0x6,0x0,0x2,0x2,0x2,0x2,0x0,0x6,0x6}, 191 {0x6,0x6,0x0,0x2,0x32,0x32,0x2,0x0,0x6,0x6},
192 {0x0,0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x0,0x0}, 192 {0x0,0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x0,0x0},
193 {0x0,0x6,0x6,0x0,0x0,0x0,0x0,0x6,0x6,0x0}, 193 {0x0,0x6,0x6,0x0,0x0,0x0,0x0,0x6,0x6,0x0},
194 {0x0,0x0,0x0,0x5,0x5,0x5,0x5,0x0,0x0,0x0}, 194 {0x0,0x0,0x0,0x5,0x25,0x25,0x5,0x0,0x0,0x0},
195 {0x0,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x0}, 195 {0x0,0x5,0x5,0x25,0x5,0x5,0x25,0x5,0x5,0x0},
196 {0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5} 196 {0x5,0x5,0x25,0x5,0x5,0x5,0x5,0x25,0x5,0x5}
197 }, 197 },
198 { /* level9 */ 198 { /* level9 */
199 {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2}, 199 {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2},
@@ -250,9 +250,9 @@ static unsigned char levels[29][8][10] = {
250 {0x4,0x4,0x4,0x4,0x2,0x2,0x4,0x4,0x4,0x4}, 250 {0x4,0x4,0x4,0x4,0x2,0x2,0x4,0x4,0x4,0x4},
251 {0x4,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x4}, 251 {0x4,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x4},
252 {0x4,0x0,0x0,0x2,0x3,0x3,0x2,0x0,0x0,0x4}, 252 {0x4,0x0,0x0,0x2,0x3,0x3,0x2,0x0,0x0,0x4},
253 {0x4,0x0,0x2,0x3,0x3,0x3,0x3,0x2,0x0,0x4}, 253 {0x4,0x0,0x2,0x23,0x3,0x3,0x23,0x2,0x0,0x4},
254 {0x4,0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x0,0x4}, 254 {0x4,0x0,0x2,0x22,0x2,0x2,0x22,0x2,0x0,0x4},
255 {0x4,0x0,0x6,0x1,0x5,0x5,0x1,0x6,0x0,0x4}, 255 {0x4,0x0,0x6,0x21,0x5,0x5,0x21,0x6,0x0,0x4},
256 {0x4,0x6,0x1,0x1,0x5,0x5,0x1,0x1,0x6,0x4} 256 {0x4,0x6,0x1,0x1,0x5,0x5,0x1,0x1,0x6,0x4}
257 }, 257 },
258 {/* level 15 */ 258 {/* level 15 */
@@ -306,14 +306,14 @@ static unsigned char levels[29][8][10] = {
306 {0x5,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x1,0x0} 306 {0x5,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x1,0x0}
307 }, 307 },
308 { /* level 20 (Maze) by ts-x */ 308 { /* level 20 (Maze) by ts-x */
309 {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1}, 309 {0x1,0x1,0x21,0x1,0x1,0x1,0x1,0x1,0x1,0x21},
310 {0x1,0x0,0x0,0x3,0x0,0x0,0x3,0x1,0x1,0x1}, 310 {0x1,0x0,0x0,0x3,0x0,0x0,0x3,0x1,0x31,0x1},
311 {0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1}, 311 {0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x31,0x0,0x1},
312 {0x1,0x0,0x1,0x3,0x0,0x3,0x0,0x3,0x0,0x2}, 312 {0x21,0x0,0x21,0x3,0x0,0x3,0x0,0x3,0x0,0x2},
313 {0x1,0x0,0x1,0x1,0x0,0x1,0x0,0x0,0x0,0x0}, 313 {0x1,0x0,0x1,0x21,0x0,0x12,0x0,0x0,0x0,0x0},
314 {0x1,0x0,0x1,0x0,0x0,0x1,0x0,0x0,0x3,0x0}, 314 {0x31,0x0,0x1,0x0,0x0,0x1,0x0,0x0,0x3,0x0},
315 {0x1,0x0,0x1,0x0,0x1,0x1,0x1,0x1,0x1,0x2}, 315 {0x1,0x0,0x1,0x0,0x1,0x1,0x31,0x1,0x1,0x2},
316 {0x2,0x0,0x2,0x1,0x1,0x1,0x1,0x1,0x1,0x1} 316 {0x22,0x0,0x2,0x1,0x1,0x1,0x1,0x1,0x1,0x21}
317 }, 317 },
318 { /* level 21 (Dentist) by ts-x */ 318 { /* level 21 (Dentist) by ts-x */
319 {0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0}, 319 {0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0},
@@ -326,13 +326,13 @@ static unsigned char levels[29][8][10] = {
326 {0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0} 326 {0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0}
327 }, 327 },
328 { /* level 22 (Spider) by ts-x */ 328 { /* level 22 (Spider) by ts-x */
329 {0x1,0x3,0x1,0x1,0x0,0x0,0x1,0x1,0x3,0x1}, 329 {0x31,0x3,0x1,0x1,0x0,0x0,0x1,0x1,0x3,0x31},
330 {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0}, 330 {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0},
331 {0x3,0x1,0x1,0x6,0x1,0x1,0x6,0x1,0x1,0x3}, 331 {0x33,0x1,0x1,0x36,0x1,0x1,0x36,0x1,0x1,0x33},
332 {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0}, 332 {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0},
333 {0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x1,0x0,0x0}, 333 {0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x1,0x0,0x0},
334 {0x1,0x3,0x1,0x1,0x2,0x2,0x1,0x1,0x3,0x1}, 334 {0x21,0x3,0x1,0x21,0x2,0x2,0x21,0x1,0x3,0x21},
335 {0x0,0x0,0x0,0x1,0x1,0x1,0x1,0x0,0x0,0x0}, 335 {0x0,0x0,0x0,0x1,0x21,0x1,0x1,0x0,0x0,0x0},
336 {0x3,0x1,0x3,0x1,0x0,0x0,0x1,0x3,0x1,0x3} 336 {0x3,0x1,0x3,0x1,0x0,0x0,0x1,0x3,0x1,0x3}
337 }, 337 },
338 { /* level 23 (Pool) by ts-x */ 338 { /* level 23 (Pool) by ts-x */
@@ -357,13 +357,13 @@ static unsigned char levels[29][8][10] = {
357 }, 357 },
358 {/* level 25 (Rainbow) by ts-x */ 358 {/* level 25 (Rainbow) by ts-x */
359 {0x0,0x4,0x1,0x0,0x0,0x0,0x0,0x1,0x4,0x0}, 359 {0x0,0x4,0x1,0x0,0x0,0x0,0x0,0x1,0x4,0x0},
360 {0x4,0x1,0x3,0x1,0x0,0x0,0x1,0x3,0x1,0x4}, 360 {0x24,0x1,0x3,0x1,0x0,0x0,0x21,0x3,0x1,0x24},
361 {0x1,0x3,0x5,0x3,0x1,0x1,0x3,0x5,0x3,0x1}, 361 {0x1,0x23,0x5,0x3,0x1,0x21,0x3,0x5,0x3,0x21},
362 {0x3,0x5,0x6,0x5,0x3,0x3,0x5,0x6,0x5,0x3}, 362 {0x3,0x5,0x6,0x5,0x3,0x3,0x5,0x6,0x5,0x3},
363 {0x5,0x6,0x7,0x6,0x5,0x5,0x6,0x7,0x6,0x5}, 363 {0x5,0x6,0x7,0x6,0x5,0x5,0x6,0x7,0x6,0x5},
364 {0x6,0x7,0x2,0x7,0x6,0x6,0x7,0x2,0x7,0x6}, 364 {0x6,0x7,0x2,0x27,0x6,0x6,0x27,0x2,0x7,0x6},
365 {0x7,0x2,0x0,0x2,0x7,0x7,0x2,0x0,0x2,0x7}, 365 {0x7,0x2,0x0,0x2,0x27,0x27,0x2,0x0,0x2,0x7},
366 {0x2,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x2} 366 {0x32,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x32}
367 }, 367 },
368 { /* level 26 (Bowtie) by ts-x */ 368 { /* level 26 (Bowtie) by ts-x */
369 {0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5}, 369 {0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5},
@@ -376,33 +376,33 @@ static unsigned char levels[29][8][10] = {
376 {0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5} 376 {0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5}
377 }, 377 },
378 { /* level 27 (Frog) by ts-x */ 378 { /* level 27 (Frog) by ts-x */
379 {0x0,0x5,0x5,0x0,0x0,0x0,0x0,0x5,0x5,0x0}, 379 {0x0,0x5,0x25,0x0,0x0,0x0,0x0,0x25,0x5,0x0},
380 {0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5}, 380 {0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5},
381 {0x5,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x5}, 381 {0x25,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x25},
382 {0x5,0x0,0x3,0x0,0x6,0x6,0x0,0x3,0x0,0x5}, 382 {0x5,0x0,0x3,0x0,0x6,0x6,0x0,0x3,0x0,0x5},
383 {0x5,0x0,0x1,0x0,0x6,0x6,0x0,0x1,0x0,0x5}, 383 {0x5,0x0,0x31,0x0,0x6,0x6,0x0,0x31,0x0,0x5},
384 {0x5,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x5}, 384 {0x5,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x5},
385 {0x5,0x5,0x5,0x5,0x0,0x0,0x5,0x5,0x5,0x5}, 385 {0x5,0x5,0x5,0x35,0x0,0x0,0x35,0x5,0x5,0x5},
386 {0x0,0x5,0x5,0x0,0x4,0x4,0x0,0x5,0x5,0x0} 386 {0x0,0x25,0x5,0x0,0x4,0x4,0x0,0x5,0x25,0x0}
387 }, 387 },
388 { /* level 28 (DigDug) by ts-x */ 388 { /* level 28 (DigDug) by ts-x */
389 {0x5,0x5,0x5,0x5,0x0,0x5,0x5,0x5,0x5,0x5}, 389 {0x35,0x5,0x5,0x25,0x0,0x25,0x25,0x5,0x5,0x35},
390 {0x6,0x0,0x0,0x6,0x0,0x6,0x6,0x0,0x0,0x6}, 390 {0x6,0x0,0x0,0x6,0x0,0x6,0x6,0x0,0x0,0x6},
391 {0x7,0x0,0x7,0x7,0x0,0x7,0x7,0x7,0x0,0x7}, 391 {0x7,0x0,0x37,0x37,0x0,0x37,0x37,0x7,0x0,0x7},
392 {0x7,0x0,0x7,0x0,0x0,0x0,0x7,0x7,0x7,0x7}, 392 {0x7,0x0,0x7,0x0,0x0,0x0,0x7,0x7,0x7,0x7},
393 {0x4,0x4,0x4,0x4,0x0,0x4,0x4,0x0,0x0,0x4}, 393 {0x4,0x4,0x4,0x24,0x0,0x24,0x4,0x0,0x0,0x4},
394 {0x4,0x4,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4}, 394 {0x4,0x4,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4},
395 {0x4,0x4,0x4,0x4,0x4,0x4,0x0,0x0,0x4,0x4}, 395 {0x24,0x24,0x4,0x4,0x4,0x4,0x0,0x0,0x24,0x4},
396 {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1} 396 {0x1,0x1,0x1,0x1,0x1,0x1,0x21,0x21,0x1,0x1}
397 }, 397 },
398 { /* TheEnd */ 398 { /* TheEnd */
399 {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, 399 {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
400 {0x2,0x2,0x6,0x0,0x0,0x6,0x4,0x4,0x0,0x0}, 400 {0x22,0x22,0x26,0x0,0x0,0x26,0x24,0x24,0x0,0x0},
401 {0x2,0x0,0x6,0x6,0x0,0x6,0x4,0x0,0x4,0x0}, 401 {0x22,0x0,0x26,0x26,0x0,0x26,0x24,0x0,0x24,0x0},
402 {0x2,0x2,0x6,0x6,0x0,0x6,0x4,0x0,0x4,0x0}, 402 {0x22,0x22,0x26,0x26,0x0,0x26,0x24,0x0,0x24,0x0},
403 {0x2,0x2,0x6,0x0,0x6,0x6,0x4,0x0,0x4,0x0}, 403 {0x22,0x22,0x26,0x0,0x26,0x26,0x24,0x0,0x24,0x0},
404 {0x2,0x0,0x6,0x0,0x6,0x6,0x4,0x0,0x4,0x0}, 404 {0x22,0x0,0x26,0x0,0x26,0x26,0x24,0x0,0x24,0x0},
405 {0x2,0x2,0x6,0x0,0x0,0x6,0x4,0x4,0x0,0x0}, 405 {0x22,0x22,0x26,0x0,0x0,0x26,0x24,0x24,0x0,0x0},
406 {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} 406 {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}
407 } 407 }
408}; 408};
@@ -417,7 +417,7 @@ int start_game,con_game;
417int pad_type; 417int pad_type;
418int on_the_pad=0; /* for glue pad */ 418int on_the_pad=0; /* for glue pad */
419int score=0,vscore=0; 419int score=0,vscore=0;
420 420bool flip_sides=false;
421int cur_level=0; 421int cur_level=0;
422int brick_on_board=0; 422int brick_on_board=0;
423 423
@@ -427,6 +427,7 @@ typedef struct cube {
427 char poweruse; 427 char poweruse;
428 char used; 428 char used;
429 int color; 429 int color;
430 int hits;
430} cube; 431} cube;
431cube brick[80]; 432cube brick[80];
432 433
@@ -446,7 +447,6 @@ static struct configdata config[] =
446 {TYPE_INT, 0, MAX_POINTS, &highscore, "highscore", NULL, NULL} 447 {TYPE_INT, 0, MAX_POINTS, &highscore, "highscore", NULL, NULL}
447}; 448};
448 449
449
450void int_game(int new_game) 450void int_game(int new_game)
451{ 451{
452 int i,j; 452 int i,j;
@@ -461,6 +461,8 @@ void int_game(int new_game)
461 on_the_pad=0; 461 on_the_pad=0;
462 balltempy=0; 462 balltempy=0;
463 balltempx=0; 463 balltempx=0;
464 flip_sides=false;
465
464 if (new_game==1) 466 if (new_game==1)
465 brick_on_board=0; 467 brick_on_board=0;
466 468
@@ -470,15 +472,17 @@ void int_game(int new_game)
470 if (i*10+j<=30) fire[i*10+j].top=-8; 472 if (i*10+j<=30) fire[i*10+j].top=-8;
471 if (new_game==1) { 473 if (new_game==1) {
472 474
473 brick[i*10+j].power=rb->rand()%17; 475 brick[i*10+j].power=rb->rand()%25; /* +8 make the game with less powerups */
474 476 brick[i*10+j].hits=levels[cur_level][i][j]>=10?
477 levels[cur_level][i][j]/16-1:0;
475 brick[i*10+j].powertop=30+i*10+BRICK_HEIGHT; 478 brick[i*10+j].powertop=30+i*10+BRICK_HEIGHT;
476 brick[i*10+j].used=(levels[cur_level][i][j]==0?0:1); 479 brick[i*10+j].used=(levels[cur_level][i][j]==0?0:1);
477 brick[i*10+j].color=levels[cur_level][i][j]-1; 480 brick[i*10+j].color=(levels[cur_level][i][j]>=10?
481 levels[cur_level][i][j]%16:levels[cur_level][i][j])-1;
478 if (levels[cur_level][i][j]!=0) brick_on_board++; 482 if (levels[cur_level][i][j]!=0) brick_on_board++;
479 } 483 }
480 } 484 }
481 } 485 }
482 486
483 487
484} 488}
@@ -682,10 +686,11 @@ int fire_space(void)
682 return NULL; 686 return NULL;
683} 687}
684 688
685int dxball_game(void){ 689int game_loop(void){
686 int j,i,k,bricky,brickx; 690 int j,i,k,bricky,brickx;
687 char s[20]; 691 char s[20];
688 692 int sec_count=0,num_count=10;
693
689 rb->srand( *rb->current_tick ); 694 rb->srand( *rb->current_tick );
690 695
691 configfile_init(rb); 696 configfile_init(rb);
@@ -708,15 +713,28 @@ int dxball_game(void){
708 break; 713 break;
709 } 714 }
710 715
711 while(true) { 716 while(true) {
712 if (life >= 0) { 717 if (life >= 0) {
713 rb->lcd_set_background(LCD_BLACK); 718 rb->lcd_set_background(LCD_BLACK);
714 rb->lcd_set_drawmode(DRMODE_SOLID); 719 rb->lcd_set_drawmode(DRMODE_SOLID);
715 rb->lcd_clear_display(); 720 rb->lcd_clear_display();
716 rb->lcd_set_background(LCD_BLACK); 721 rb->lcd_set_background(LCD_BLACK);
717
718 /* write life num */
719 rb->lcd_set_foreground(LCD_WHITE); 722 rb->lcd_set_foreground(LCD_WHITE);
723
724 if (flip_sides) {
725 if (*rb->current_tick>=sec_count){
726 sec_count=*rb->current_tick+HZ;
727 if (num_count!=0)
728 num_count--;
729 else
730 flip_sides=false;
731 }
732 rb->snprintf(s, sizeof(s), "%d", num_count);
733 rb->lcd_getstringsize(s, &sw, NULL);
734 rb->lcd_putsxy(LCD_WIDTH/2-2, 150, s);
735 }
736
737 /* write life num */
720 rb->snprintf(s, sizeof(s), "Life: %d", life); 738 rb->snprintf(s, sizeof(s), "Life: %d", life);
721 rb->lcd_putsxy(2, 2, s); 739 rb->lcd_putsxy(2, 2, s);
722 740
@@ -734,6 +752,7 @@ int dxball_game(void){
734 if (con_game== 1 && start_game!=1) { 752 if (con_game== 1 && start_game!=1) {
735 rb->lcd_getstringsize("Press NAVI To Continue", &sw, NULL); 753 rb->lcd_getstringsize("Press NAVI To Continue", &sw, NULL);
736 rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 150, "Press NAVI to continue"); 754 rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 150, "Press NAVI to continue");
755 sec_count=*rb->current_tick+HZ;
737 } 756 }
738 757
739 /* draw the ball */ 758 /* draw the ball */
@@ -753,7 +772,7 @@ int dxball_game(void){
753 /* the bricks */ 772 /* the bricks */
754 for (i=0;i<=7;i++) { 773 for (i=0;i<=7;i++) {
755 for (j=0;j<=9;j++) { 774 for (j=0;j<=9;j++) {
756 if (brick[i*10+j].power<5) { 775 if (brick[i*10+j].power<6) {
757 if (brick[i*10+j].poweruse==2) { 776 if (brick[i*10+j].poweruse==2) {
758 if (con_game!=1) 777 if (con_game!=1)
759 brick[i*10+j].powertop+=2; 778 brick[i*10+j].powertop+=2;
@@ -790,7 +809,14 @@ int dxball_game(void){
790 score+=23; 809 score+=23;
791 pad_type=0; 810 pad_type=0;
792 on_the_pad=0; 811 on_the_pad=0;
812 flip_sides=false;
793 break; 813 break;
814 case 5:
815 score+=23;
816 sec_count=*rb->current_tick+HZ;
817 num_count=10;
818 flip_sides=!flip_sides;
819 break;
794 } 820 }
795 brick[i*10+j].poweruse=1; 821 brick[i*10+j].poweruse=1;
796 } 822 }
@@ -806,9 +832,15 @@ int dxball_game(void){
806 if (brick[i*10+j].used==1 && (fire[k].left+1 >= brickx && fire[k].left+1 <= brickx+BRICK_WIDTH) && (bricky+BRICK_HEIGHT>fire[k].top)){ 832 if (brick[i*10+j].used==1 && (fire[k].left+1 >= brickx && fire[k].left+1 <= brickx+BRICK_WIDTH) && (bricky+BRICK_HEIGHT>fire[k].top)){
807 score+=13; 833 score+=13;
808 fire[k].top=-16; 834 fire[k].top=-16;
809 brick[i*10+j].used=0; 835 if (brick[i*10+j].hits > 0){
810 if (brick[i*10+j].power!=10) brick[i*10+j].poweruse=2; 836 brick[i*10+j].hits--;
811 brick_on_board--; 837 score+=3;
838 }
839 else {
840 brick[i*10+j].used=0;
841 if (brick[i*10+j].power!=10) brick[i*10+j].poweruse=2;
842 brick_on_board--;
843 }
812 } 844 }
813 } 845 }
814 } 846 }
@@ -831,28 +863,55 @@ int dxball_game(void){
831 } 863 }
832 864
833 if ((ball_pos_x+3 >= brickx && ball_pos_x+3 <= brickx+BRICK_WIDTH) && ((bricky+BRICK_HEIGHT==ball_pos_y) || (bricky+BRICK_HEIGHT-6<=ball_pos_y && bricky+BRICK_HEIGHT>ball_pos_y)) && (bally <0)) { /* bottom line */ 865 if ((ball_pos_x+3 >= brickx && ball_pos_x+3 <= brickx+BRICK_WIDTH) && ((bricky+BRICK_HEIGHT==ball_pos_y) || (bricky+BRICK_HEIGHT-6<=ball_pos_y && bricky+BRICK_HEIGHT>ball_pos_y)) && (bally <0)) { /* bottom line */
834 brick[i*10+j].used=0; 866 if (brick[i*10+j].hits > 0){
835 bally = bally*-1; 867 brick[i*10+j].hits--;
836 if (brick[i*10+j].power!=10) { 868 score+=2;
837 brick[i*10+j].poweruse=2; 869 }
870 else {
871 brick[i*10+j].used=0;
872 if (brick[i*10+j].power!=10)
873 brick[i*10+j].poweruse=2;
838 } 874 }
875
876 bally = bally*-1;
839 } else if ((ball_pos_x+3 >= brickx && ball_pos_x+3 <= brickx+BRICK_WIDTH) && ((bricky==ball_pos_y+BALL) || (bricky+6>=ball_pos_y+BALL && bricky<ball_pos_y+BALL)) && (bally >0)) { /* top line */ 877 } else if ((ball_pos_x+3 >= brickx && ball_pos_x+3 <= brickx+BRICK_WIDTH) && ((bricky==ball_pos_y+BALL) || (bricky+6>=ball_pos_y+BALL && bricky<ball_pos_y+BALL)) && (bally >0)) { /* top line */
840 brick[i*10+j].used=0; 878 if (brick[i*10+j].hits > 0){
879 brick[i*10+j].hits--;
880 score+=2;
881 }
882 else {
883 brick[i*10+j].used=0;
884 if (brick[i*10+j].power!=10)
885 brick[i*10+j].poweruse=2;
886 }
887
841 bally = bally*-1; 888 bally = bally*-1;
842 if (brick[i*10+j].power!=10)
843 brick[i*10+j].poweruse=2;
844 } 889 }
845 890
846 if ((ball_pos_y+3 >= bricky && ball_pos_y+3 <= bricky+BRICK_HEIGHT) && ((brickx==ball_pos_x+BALL) || (brickx+6>=ball_pos_x+BALL && brickx<ball_pos_x+BALL)) && (ballx > 0)) { /* left line */ 891 if ((ball_pos_y+3 >= bricky && ball_pos_y+3 <= bricky+BRICK_HEIGHT) && ((brickx==ball_pos_x+BALL) || (brickx+6>=ball_pos_x+BALL && brickx<ball_pos_x+BALL)) && (ballx > 0)) { /* left line */
847 brick[i*10+j].used=0; 892 if (brick[i*10+j].hits > 0){
893 brick[i*10+j].hits--;
894 score+=2;
895 }
896 else {
897 brick[i*10+j].used=0;
898 if (brick[i*10+j].power!=10)
899 brick[i*10+j].poweruse=2;
900 }
848 ballx = ballx*-1; 901 ballx = ballx*-1;
849 if (brick[i*10+j].power!=10) 902
850 brick[i*10+j].poweruse=2;
851 } else if ((ball_pos_y+3 >= bricky && ball_pos_y+3 <= bricky+BRICK_HEIGHT) && ((brickx+BRICK_WIDTH==ball_pos_x) || (brickx+BRICK_WIDTH-6<=ball_pos_x && brickx+BRICK_WIDTH>ball_pos_x)) && (ballx < 0)) { /* Right line */ 903 } else if ((ball_pos_y+3 >= bricky && ball_pos_y+3 <= bricky+BRICK_HEIGHT) && ((brickx+BRICK_WIDTH==ball_pos_x) || (brickx+BRICK_WIDTH-6<=ball_pos_x && brickx+BRICK_WIDTH>ball_pos_x)) && (ballx < 0)) { /* Right line */
852 brick[i*10+j].used=0; 904 if (brick[i*10+j].hits > 0){
905 brick[i*10+j].hits--;
906 score+=2;
907 }
908 else {
909 brick[i*10+j].used=0;
910 if (brick[i*10+j].power!=10)
911 brick[i*10+j].poweruse=2;
912 }
913
853 ballx = ballx*-1; 914 ballx = ballx*-1;
854 if (brick[i*10+j].power!=10)
855 brick[i*10+j].poweruse=2;
856 } 915 }
857 916
858 if (brick[i*10+j].used==0){ 917 if (brick[i*10+j].used==0){
@@ -980,7 +1039,7 @@ int dxball_game(void){
980 button=rb->button_get_w_tmo(end - *rb->current_tick); 1039 button=rb->button_get_w_tmo(end - *rb->current_tick);
981 move_button=rb->button_status(); 1040 move_button=rb->button_status();
982 1041
983 if (move_button & RIGHT) { 1042 if ((move_button & RIGHT && flip_sides==false) || (flip_sides==true && move_button & LEFT)) {
984 if (pad_pos_x+8+PAD_WIDTH > LCD_WIDTH) { 1043 if (pad_pos_x+8+PAD_WIDTH > LCD_WIDTH) {
985 if (start_game==1 || on_the_pad==1) ball_pos_x+=LCD_WIDTH-pad_pos_x-PAD_WIDTH; 1044 if (start_game==1 || on_the_pad==1) ball_pos_x+=LCD_WIDTH-pad_pos_x-PAD_WIDTH;
986 pad_pos_x+=LCD_WIDTH-pad_pos_x-PAD_WIDTH; 1045 pad_pos_x+=LCD_WIDTH-pad_pos_x-PAD_WIDTH;
@@ -989,7 +1048,7 @@ int dxball_game(void){
989 ball_pos_x+=8; 1048 ball_pos_x+=8;
990 pad_pos_x+=8; 1049 pad_pos_x+=8;
991 } 1050 }
992 } else if (move_button & LEFT) { 1051 } else if ((move_button & LEFT && flip_sides==false) || (flip_sides==true && move_button & RIGHT)) {
993 if (pad_pos_x-8 < 0) { 1052 if (pad_pos_x-8 < 0) {
994 if (start_game==1 || on_the_pad==1) ball_pos_x-=pad_pos_x; 1053 if (start_game==1 || on_the_pad==1) ball_pos_x-=pad_pos_x;
995 pad_pos_x-=pad_pos_x; 1054 pad_pos_x-=pad_pos_x;
@@ -1101,7 +1160,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
1101 rb->backlight_set_timeout(1); 1160 rb->backlight_set_timeout(1);
1102 1161
1103 /* now go ahead and have fun! */ 1162 /* now go ahead and have fun! */
1104 while (dxball_game()!=1); 1163 while (game_loop()!=1);
1105 1164
1106 configfile_save(HIGH_SCORE,config,1,0); 1165 configfile_save(HIGH_SCORE,config,1,0);
1107 1166