2008-12-04 03:34:55 +00:00
|
|
|
|
|
|
|
#include <setjmp.h>
|
2008-12-05 02:53:09 +00:00
|
|
|
#include <stdio.h>
|
2008-12-04 03:34:55 +00:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "scrolltext/scrolltext.h"
|
2011-02-23 10:33:27 +00:00
|
|
|
#include "animations/snake.h"
|
2011-11-07 22:35:57 +00:00
|
|
|
#include "animations/program.h"
|
2008-12-04 03:34:55 +00:00
|
|
|
#include "animations/matrix.h"
|
|
|
|
#include "animations/gameoflife.h"
|
2011-10-28 18:53:38 +00:00
|
|
|
#include "animations/stonefly.h"
|
2009-12-27 00:51:07 +00:00
|
|
|
#include "animations/flyingdots.h"
|
2010-04-09 20:41:23 +00:00
|
|
|
#include "animations/breakout_demo.h"
|
2010-04-11 06:29:08 +00:00
|
|
|
#include "animations/ltn_ant.h"
|
2012-09-15 23:18:43 +00:00
|
|
|
#include "animations/bitmapscroller/laborlogo.h"
|
|
|
|
#include "animations/bitmapscroller/amphibian.h"
|
|
|
|
#include "animations/bitmapscroller/outofspec.h"
|
|
|
|
#include "animations/bitmapscroller/fairydust.h"
|
2011-03-17 23:03:03 +00:00
|
|
|
#include "animations/fpmath_patterns.h"
|
2011-02-24 23:13:01 +00:00
|
|
|
#include "animations/mherweg.h"
|
2011-12-15 04:43:40 +00:00
|
|
|
#include "animations/blackhole.h"
|
2012-08-15 04:05:04 +00:00
|
|
|
#include "animations/squares.h"
|
2011-10-28 20:20:55 +00:00
|
|
|
#ifdef ANIMATION_TIME
|
2011-10-28 18:53:38 +00:00
|
|
|
#include "animations/borg_time.h"
|
2011-10-28 20:20:55 +00:00
|
|
|
#endif
|
2008-12-04 03:34:55 +00:00
|
|
|
#include "borg_hw/borg_hw.h"
|
|
|
|
#include "can/borg_can.h"
|
|
|
|
#include "random/prng.h"
|
|
|
|
#include "random/persistentCounter.h"
|
|
|
|
#include "mcuf/mcuf.h"
|
|
|
|
#include "menu/menu.h"
|
|
|
|
#include "pixel.h"
|
2011-05-12 20:16:14 +00:00
|
|
|
#ifdef SMALLANIMATION_ROWWALK
|
2011-05-13 13:16:26 +00:00
|
|
|
# include "smallani/rowwalk.h"
|
2011-05-12 20:16:14 +00:00
|
|
|
#endif
|
|
|
|
#ifdef SMALLANIMATION_COLWALK
|
2011-05-13 13:16:26 +00:00
|
|
|
# include "smallani/colwalk.h"
|
|
|
|
#endif
|
2014-03-18 18:51:38 +00:00
|
|
|
#ifdef SMALLANIMATION_ROWBOUNCE
|
|
|
|
# include "smallani/rowbounce.h"
|
|
|
|
#endif
|
2011-05-13 13:16:26 +00:00
|
|
|
#ifdef SMALLANIMATION_COLBOUNCE
|
|
|
|
# include "smallani/colbounce.h"
|
2011-05-12 20:16:14 +00:00
|
|
|
#endif
|
|
|
|
|
2011-05-09 20:54:01 +00:00
|
|
|
#ifdef JOYSTICK_SUPPORT
|
|
|
|
# include "joystick/joystick.h"
|
|
|
|
#endif
|
2008-12-04 03:34:55 +00:00
|
|
|
|
|
|
|
volatile unsigned char oldMode, oldOldmode, mode;
|
|
|
|
|
|
|
|
jmp_buf newmode_jmpbuf;
|
|
|
|
|
2010-01-14 01:38:15 +00:00
|
|
|
#ifndef MENU_SUPPORT
|
|
|
|
void snake_game(void);
|
|
|
|
void tetris(void);
|
|
|
|
void tetris_bastet(void);
|
2011-02-25 04:34:09 +00:00
|
|
|
void tetris_fp(void);
|
2010-01-14 01:38:15 +00:00
|
|
|
void borg_invaders(void);
|
2011-02-25 04:34:09 +00:00
|
|
|
void borg_breakout(unsigned char demomode);
|
2010-01-14 01:38:15 +00:00
|
|
|
#endif
|
|
|
|
|
2008-12-04 03:34:55 +00:00
|
|
|
void display_loop(){
|
|
|
|
// mcuf_serial_mode();
|
2009-08-01 22:58:01 +00:00
|
|
|
|
2009-02-19 00:46:02 +00:00
|
|
|
mode = setjmp(newmode_jmpbuf);
|
2008-12-04 03:34:55 +00:00
|
|
|
oldOldmode = oldMode;
|
2009-02-19 00:54:57 +00:00
|
|
|
|
2009-08-01 22:58:01 +00:00
|
|
|
#ifdef JOYSTICK_SUPPORT
|
2008-12-04 03:34:55 +00:00
|
|
|
waitForFire = 1;
|
2009-01-01 17:06:38 +00:00
|
|
|
#endif
|
|
|
|
|
2008-12-04 03:34:55 +00:00
|
|
|
for(;;){
|
2011-02-25 04:34:09 +00:00
|
|
|
#ifndef MENU_SUPPORT
|
|
|
|
clear_screen(0);
|
|
|
|
#endif
|
2008-12-04 03:34:55 +00:00
|
|
|
oldMode = mode;
|
|
|
|
switch(mode++) {
|
|
|
|
|
|
|
|
#ifdef ANIMATION_SCROLLTEXT
|
|
|
|
case 1:
|
|
|
|
scrolltext(scrolltext_text);
|
2009-08-01 22:58:01 +00:00
|
|
|
|
2011-10-28 18:53:38 +00:00
|
|
|
#ifdef RANDOM_SUPPORT
|
2011-02-25 04:34:09 +00:00
|
|
|
{
|
|
|
|
char a[28];
|
2010-04-22 21:49:26 +00:00
|
|
|
sprintf(a,"</# counter == %lu ", (unsigned long) percnt_get());
|
2008-12-05 14:17:04 +00:00
|
|
|
scrolltext(a);
|
|
|
|
}
|
2011-10-28 18:53:38 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifdef ANIMATION_TIME
|
2011-10-28 21:52:17 +00:00
|
|
|
#ifndef ANIMATION_SCROLLTEXT
|
|
|
|
case 1:
|
2011-10-28 18:53:38 +00:00
|
|
|
#endif
|
2011-10-28 21:52:17 +00:00
|
|
|
time_anim();
|
2008-12-04 03:34:55 +00:00
|
|
|
break;
|
2011-10-29 05:59:46 +00:00
|
|
|
#else
|
2011-10-28 21:52:17 +00:00
|
|
|
#ifdef ANIMATION_SCROLLTEXT
|
|
|
|
break;
|
|
|
|
#endif
|
2008-12-04 03:34:55 +00:00
|
|
|
#endif
|
|
|
|
|
2011-11-07 22:35:57 +00:00
|
|
|
#ifdef ANIMATION_SPIRAL
|
2011-12-04 08:03:19 +00:00
|
|
|
# ifndef SPIRAL_DELAY
|
|
|
|
# define SPIRAL_DELAY 5
|
|
|
|
# endif
|
|
|
|
|
2008-12-04 03:34:55 +00:00
|
|
|
case 2:
|
2011-12-04 08:03:19 +00:00
|
|
|
spiral(SPIRAL_DELAY);
|
2008-12-04 03:34:55 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ANIMATION_JOERN1
|
|
|
|
case 3:
|
|
|
|
joern1();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ANIMATION_SNAKE
|
|
|
|
case 4:
|
2011-02-23 10:33:27 +00:00
|
|
|
snake_animation();
|
2008-12-04 03:34:55 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2011-11-08 02:46:56 +00:00
|
|
|
#ifdef ANIMATION_CHECKERBOARD
|
2008-12-04 03:34:55 +00:00
|
|
|
case 5:
|
2011-11-08 02:46:56 +00:00
|
|
|
checkerboard(20);
|
2008-12-04 03:34:55 +00:00
|
|
|
break;
|
2009-08-01 22:58:01 +00:00
|
|
|
#endif
|
2008-12-04 03:34:55 +00:00
|
|
|
|
2011-11-07 22:35:57 +00:00
|
|
|
#ifdef ANIMATION_FIRE
|
2008-12-04 03:34:55 +00:00
|
|
|
case 6:
|
2011-11-07 22:35:57 +00:00
|
|
|
fire();
|
2008-12-04 03:34:55 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2011-10-28 18:53:38 +00:00
|
|
|
#ifdef ANIMATION_TIME
|
2008-12-04 03:34:55 +00:00
|
|
|
case 7:
|
2011-10-28 18:53:38 +00:00
|
|
|
time_anim();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ANIMATION_MATRIX
|
|
|
|
case 8:
|
2008-12-04 03:34:55 +00:00
|
|
|
matrix();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ANIMATION_RANDOM_BRIGHT
|
2011-10-28 18:53:38 +00:00
|
|
|
case 9:
|
2009-02-25 23:49:59 +00:00
|
|
|
random_bright(30);
|
2008-12-04 03:34:55 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2011-10-28 18:53:38 +00:00
|
|
|
#ifdef ANIMATION_STONEFLY
|
2009-12-27 00:51:07 +00:00
|
|
|
case 10:
|
2011-10-28 18:53:38 +00:00
|
|
|
stonefly();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ANIMATION_GAMEOFLIFE
|
|
|
|
case 11:
|
2008-12-04 03:34:55 +00:00
|
|
|
gameoflife();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2009-12-27 00:51:07 +00:00
|
|
|
#ifdef ANIMATION_FLYINGDOTS
|
2011-10-28 18:53:38 +00:00
|
|
|
case 12:
|
2009-12-27 00:51:07 +00:00
|
|
|
flyingdots();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2010-04-09 20:41:23 +00:00
|
|
|
#ifdef ANIMATION_BREAKOUT
|
2011-10-28 18:53:38 +00:00
|
|
|
case 13:
|
2010-04-09 20:41:23 +00:00
|
|
|
breakout_demo();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ANIMATION_MHERWEG
|
2011-10-28 18:53:38 +00:00
|
|
|
case 14:
|
2011-08-31 18:59:04 +00:00
|
|
|
mherweg();
|
2009-02-25 23:49:59 +00:00
|
|
|
break;
|
2009-06-19 21:09:08 +00:00
|
|
|
#endif
|
2008-12-04 03:34:55 +00:00
|
|
|
|
2011-10-28 18:53:38 +00:00
|
|
|
#ifdef ANIMATION_TIME
|
|
|
|
case 15:
|
|
|
|
time_anim();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2010-04-11 06:29:08 +00:00
|
|
|
#ifdef ANIMATION_LTN_ANT
|
2011-10-28 18:53:38 +00:00
|
|
|
case 16:
|
2010-04-11 06:29:08 +00:00
|
|
|
ltn_ant();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2010-04-15 21:49:43 +00:00
|
|
|
#ifdef ANIMATION_LABORLOGO
|
2011-10-28 18:53:38 +00:00
|
|
|
case 17:
|
2010-08-22 03:12:56 +00:00
|
|
|
laborlogo();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ANIMATION_AMPHIBIAN
|
2011-10-28 18:53:38 +00:00
|
|
|
case 18:
|
2010-08-22 03:12:56 +00:00
|
|
|
amphibian();
|
2010-04-15 21:49:43 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2011-09-15 03:17:44 +00:00
|
|
|
#ifdef ANIMATION_LOGO_OOS
|
2011-10-28 18:53:38 +00:00
|
|
|
case 19:
|
2011-09-15 03:17:44 +00:00
|
|
|
logo_OutOfSpec();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2011-12-19 22:47:24 +00:00
|
|
|
#ifdef ANIMATION_FAIRYDUST
|
2011-10-28 18:53:38 +00:00
|
|
|
case 20:
|
2011-12-19 22:47:24 +00:00
|
|
|
fairydust();
|
2011-11-30 23:45:00 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2012-08-11 12:10:28 +00:00
|
|
|
#ifdef ANIMATION_PLASMA
|
2013-03-18 13:58:59 +00:00
|
|
|
case 21:
|
2011-03-14 10:34:16 +00:00
|
|
|
plasma();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2011-03-17 23:03:03 +00:00
|
|
|
#ifdef ANIMATION_PSYCHEDELIC
|
2013-03-18 13:58:59 +00:00
|
|
|
case 22:
|
2011-03-17 23:03:03 +00:00
|
|
|
psychedelic();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2011-12-15 04:43:40 +00:00
|
|
|
#ifdef ANIMATION_BLACKHOLE
|
2013-03-18 13:58:59 +00:00
|
|
|
case 23:
|
2011-12-15 04:43:40 +00:00
|
|
|
blackhole();
|
|
|
|
break;
|
|
|
|
#endif
|
2011-03-14 10:34:16 +00:00
|
|
|
|
2012-08-15 04:05:04 +00:00
|
|
|
#ifdef ANIMATION_SQUARES
|
2013-03-18 13:58:59 +00:00
|
|
|
case 24:
|
2012-08-15 04:05:04 +00:00
|
|
|
squares();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2008-12-04 03:34:55 +00:00
|
|
|
#ifdef ANIMATION_TESTS
|
|
|
|
case 31:
|
2011-02-25 22:57:49 +00:00
|
|
|
test_level(1);
|
2008-12-04 03:34:55 +00:00
|
|
|
break;
|
2009-08-01 22:58:01 +00:00
|
|
|
|
2011-02-25 22:57:49 +00:00
|
|
|
case 32:
|
|
|
|
test_level(2);
|
2008-12-04 03:34:55 +00:00
|
|
|
break;
|
2009-02-18 22:26:46 +00:00
|
|
|
|
2011-02-25 22:57:49 +00:00
|
|
|
case 33:
|
|
|
|
test_level(3);
|
2008-12-04 03:34:55 +00:00
|
|
|
break;
|
2011-02-25 22:57:49 +00:00
|
|
|
|
2008-12-04 03:34:55 +00:00
|
|
|
case 35:
|
2009-02-18 22:26:46 +00:00
|
|
|
test_palette();
|
2009-12-26 23:26:06 +00:00
|
|
|
test_palette2();
|
2008-12-04 03:34:55 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2011-02-25 22:57:49 +00:00
|
|
|
|
2011-05-12 20:16:14 +00:00
|
|
|
#ifdef SMALLANIMATION_ROWWALK
|
|
|
|
case 36:
|
2011-05-14 18:09:40 +00:00
|
|
|
rowwalk(SMALLANIMATION_ROWWALK_COUNT,SMALLANIMATION_ROWWALK_SPEED);
|
2011-05-12 20:16:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef SMALLANIMATION_COLWALK
|
|
|
|
case 37:
|
2011-05-14 18:09:40 +00:00
|
|
|
colwalk(SMALLANIMATION_COLWALK_COUNT,SMALLANIMATION_COLWALK_SPEED);
|
2011-05-12 20:16:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2011-05-13 13:16:26 +00:00
|
|
|
#ifdef SMALLANIMATION_COLBOUNCE
|
|
|
|
case 38:
|
2011-06-11 16:27:44 +00:00
|
|
|
colbounce(SMALLANIMATION_COLBOUNCE_COUNT,SMALLANIMATION_COLBOUNCE_SPEED);
|
2011-05-13 13:16:26 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2011-05-14 18:09:40 +00:00
|
|
|
#ifdef SMALLANIMATION_ROWBOUNCE
|
2011-05-13 14:54:06 +00:00
|
|
|
case 39:
|
2011-06-11 16:27:44 +00:00
|
|
|
rowbounce(SMALLANIMATION_ROWBOUNCE_COUNT,SMALLANIMATION_ROWBOUNCE_SPEED);
|
2011-05-13 14:54:06 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2011-05-12 20:16:14 +00:00
|
|
|
|
2011-02-25 04:34:09 +00:00
|
|
|
#ifdef MENU_SUPPORT
|
2011-10-28 18:53:38 +00:00
|
|
|
case 42:
|
2011-02-25 04:34:09 +00:00
|
|
|
mode = 1;
|
|
|
|
break;
|
2008-12-04 03:34:55 +00:00
|
|
|
|
|
|
|
case 43:
|
|
|
|
menu();
|
|
|
|
mode = oldOldmode;
|
2011-12-15 04:43:40 +00:00
|
|
|
break;
|
2011-05-11 19:16:42 +00:00
|
|
|
#else
|
2011-05-09 20:54:01 +00:00
|
|
|
|
2011-02-25 04:34:09 +00:00
|
|
|
case 42:
|
2011-05-11 20:07:15 +00:00
|
|
|
#ifdef JOYSTICK_SUPPORT
|
2011-02-25 04:34:09 +00:00
|
|
|
if (JOYISFIRE)
|
|
|
|
mode = 43;
|
|
|
|
else
|
2011-05-11 20:07:15 +00:00
|
|
|
#endif
|
2011-02-25 04:34:09 +00:00
|
|
|
mode = 1;
|
|
|
|
break;
|
|
|
|
|
2010-01-14 01:38:15 +00:00
|
|
|
case 43:
|
2011-05-11 20:07:15 +00:00
|
|
|
#ifdef JOYSTICK_SUPPORT
|
2011-03-07 02:28:42 +00:00
|
|
|
waitForFire = 0; // avoid circular jumps
|
|
|
|
while (JOYISFIRE); // wait until user released the fire button
|
2011-05-11 20:07:15 +00:00
|
|
|
#endif
|
2011-03-07 02:28:42 +00:00
|
|
|
wait(25); // wait for button to settle
|
|
|
|
|
2011-05-09 20:54:01 +00:00
|
|
|
# ifdef GAME_TETRIS
|
2010-01-14 01:38:15 +00:00
|
|
|
tetris();
|
2011-05-09 20:54:01 +00:00
|
|
|
# endif
|
2011-03-07 02:28:42 +00:00
|
|
|
|
2011-05-09 20:54:01 +00:00
|
|
|
# ifdef GAME_BASTET
|
2010-01-14 01:38:15 +00:00
|
|
|
tetris_bastet();
|
2011-05-09 20:54:01 +00:00
|
|
|
# endif
|
2011-03-07 02:28:42 +00:00
|
|
|
|
2011-05-09 20:54:01 +00:00
|
|
|
# ifdef GAME_TETRIS_FP
|
2011-02-25 04:34:09 +00:00
|
|
|
tetris_fp();
|
2011-05-09 20:54:01 +00:00
|
|
|
# endif
|
2011-03-07 02:28:42 +00:00
|
|
|
|
2011-05-09 20:54:01 +00:00
|
|
|
# ifdef GAME_SPACE_INVADERS
|
2010-01-14 01:38:15 +00:00
|
|
|
borg_invaders();
|
2011-05-09 20:54:01 +00:00
|
|
|
# endif
|
2011-03-07 02:28:42 +00:00
|
|
|
|
2011-05-09 20:54:01 +00:00
|
|
|
# ifdef GAME_SNAKE
|
2010-01-14 01:38:15 +00:00
|
|
|
snake_game();
|
2011-05-09 20:54:01 +00:00
|
|
|
# endif
|
2011-03-07 02:28:42 +00:00
|
|
|
|
2011-05-09 20:54:01 +00:00
|
|
|
# ifdef GAME_BREAKOUT
|
2011-02-25 04:34:09 +00:00
|
|
|
borg_breakout(0);
|
2011-05-09 20:54:01 +00:00
|
|
|
# endif
|
2011-03-07 02:28:42 +00:00
|
|
|
|
2011-05-11 20:07:15 +00:00
|
|
|
#ifdef JOYSTICK_SUPPORT
|
2011-03-07 02:28:42 +00:00
|
|
|
while (JOYISFIRE); // avoid an unwanted restart of the game loop
|
2011-05-11 20:07:15 +00:00
|
|
|
#endif
|
2011-03-07 02:28:42 +00:00
|
|
|
wait(25); // wait for button to settle
|
|
|
|
mode = oldOldmode; // restore old animation mode
|
2011-05-11 20:07:15 +00:00
|
|
|
#ifdef JOYSTICK_SUPPORT
|
2011-03-07 02:28:42 +00:00
|
|
|
waitForFire = 1; // reenable joystick query of the wait() function
|
2011-05-11 20:07:15 +00:00
|
|
|
#endif
|
2011-03-07 02:28:42 +00:00
|
|
|
break;
|
2008-12-04 03:34:55 +00:00
|
|
|
#endif
|
2009-12-26 23:26:06 +00:00
|
|
|
|
|
|
|
#ifdef ANIMATION_OFF
|
|
|
|
case 0xFF:
|
|
|
|
off();
|
|
|
|
break;
|
|
|
|
#endif
|
2008-12-04 03:34:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|