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"
|
2008-12-04 03:34:55 +00:00
|
|
|
#include "animations/programm.h"
|
|
|
|
#include "animations/matrix.h"
|
|
|
|
#include "animations/gameoflife.h"
|
2009-12-27 02:11:58 +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"
|
2010-08-22 03:12:56 +00:00
|
|
|
#include "animations/amphibian.h"
|
2010-04-15 21:49:43 +00:00
|
|
|
#include "animations/laborlogo.h"
|
2010-12-18 22:53:42 +00:00
|
|
|
#include "animations/27c3.h"
|
2011-02-24 23:13:01 +00:00
|
|
|
#include "animations/mherweg.h"
|
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"
|
2009-01-02 02:18:20 +00:00
|
|
|
#include "joystick/joystick.h"
|
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
|
|
|
|
2008-12-05 14:17:04 +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);
|
|
|
|
}
|
|
|
|
#endif
|
2008-12-04 03:34:55 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ANIMATION_SPIRALE
|
|
|
|
case 2:
|
|
|
|
spirale(5);
|
|
|
|
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
|
|
|
|
|
|
|
|
#ifdef ANIMATION_SCHACHBRETT
|
|
|
|
case 5:
|
2010-12-22 23:18:11 +00:00
|
|
|
schachbrett(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
|
|
|
|
|
|
|
#ifdef ANIMATION_FEUER
|
|
|
|
case 6:
|
|
|
|
feuer();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ANIMATION_MATRIX
|
|
|
|
case 7:
|
|
|
|
matrix();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ANIMATION_RANDOM_BRIGHT
|
|
|
|
case 8:
|
2009-02-25 23:49:59 +00:00
|
|
|
random_bright(30);
|
2008-12-04 03:34:55 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2009-12-27 02:11:58 +00:00
|
|
|
#ifdef ANIMATION_STONEFLY
|
|
|
|
case 9:
|
|
|
|
stonefly();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2009-12-27 00:51:07 +00:00
|
|
|
#ifdef ANIMATION_GAMEOFLIFE
|
|
|
|
case 10:
|
2008-12-04 03:34:55 +00:00
|
|
|
gameoflife();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2009-12-27 00:51:07 +00:00
|
|
|
#ifdef ANIMATION_FLYINGDOTS
|
2009-12-27 02:17:36 +00:00
|
|
|
case 11:
|
2009-12-27 00:51:07 +00:00
|
|
|
flyingdots();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2010-04-09 20:41:23 +00:00
|
|
|
#ifdef ANIMATION_BREAKOUT
|
2009-12-27 02:17:36 +00:00
|
|
|
case 12:
|
2010-04-09 20:41:23 +00:00
|
|
|
breakout_demo();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ANIMATION_MHERWEG
|
|
|
|
case 13:
|
2009-12-26 23:26:06 +00:00
|
|
|
lines1();
|
|
|
|
dots1();
|
|
|
|
movinglines();
|
|
|
|
checkbox();
|
2009-02-25 23:49:59 +00:00
|
|
|
rectangle1();
|
2009-12-26 23:26:06 +00:00
|
|
|
rectangles();
|
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
|
|
|
|
2010-04-11 06:29:08 +00:00
|
|
|
#ifdef ANIMATION_LTN_ANT
|
|
|
|
case 14:
|
|
|
|
ltn_ant();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2010-04-15 21:49:43 +00:00
|
|
|
#ifdef ANIMATION_LABORLOGO
|
|
|
|
case 15:
|
2010-08-22 03:12:56 +00:00
|
|
|
laborlogo();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ANIMATION_AMPHIBIAN
|
|
|
|
case 16:
|
|
|
|
amphibian();
|
2010-04-15 21:49:43 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2010-12-18 22:53:42 +00:00
|
|
|
#ifdef ANIMATION_LOGO_27C3
|
|
|
|
case 17:
|
|
|
|
logo_27c3();
|
|
|
|
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-02-25 04:34:09 +00:00
|
|
|
#ifdef MENU_SUPPORT
|
2009-12-27 02:11:58 +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;
|
2010-01-14 01:38:15 +00:00
|
|
|
#else
|
|
|
|
#ifdef GAME_TETRIS
|
2011-02-25 04:34:09 +00:00
|
|
|
case 42:
|
|
|
|
if (JOYISFIRE)
|
|
|
|
mode = 43;
|
|
|
|
else
|
|
|
|
mode = 1;
|
|
|
|
break;
|
|
|
|
|
2010-01-14 01:38:15 +00:00
|
|
|
case 43:
|
2011-02-25 04:34:09 +00:00
|
|
|
waitForFire = 0;
|
|
|
|
while (JOYISFIRE);
|
2010-01-14 01:38:15 +00:00
|
|
|
tetris();
|
2011-02-25 04:34:09 +00:00
|
|
|
while (JOYISFIRE);
|
|
|
|
mode = oldOldmode;
|
|
|
|
waitForFire = 1;
|
2010-01-14 01:38:15 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef GAME_BASTET
|
|
|
|
case 44:
|
2011-02-25 04:34:09 +00:00
|
|
|
waitForFire = 0;
|
|
|
|
while (JOYISFIRE);
|
2010-01-14 01:38:15 +00:00
|
|
|
tetris_bastet();
|
2011-02-25 04:34:09 +00:00
|
|
|
while (JOYISFIRE);
|
|
|
|
mode = oldOldmode;
|
|
|
|
waitForFire = 1;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef GAME_TETRIS_FP
|
|
|
|
case 45:
|
|
|
|
waitForFire = 0;
|
|
|
|
while (JOYISFIRE);
|
|
|
|
tetris_fp();
|
|
|
|
while (JOYISFIRE);
|
|
|
|
mode = oldOldmode;
|
|
|
|
waitForFire = 1;
|
2010-01-14 01:38:15 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef GAME_SPACE_INVADERS
|
|
|
|
case 45:
|
2011-02-25 04:34:09 +00:00
|
|
|
waitForFire = 0;
|
|
|
|
while (JOYISFIRE);
|
2010-01-14 01:38:15 +00:00
|
|
|
borg_invaders();
|
2011-02-25 04:34:09 +00:00
|
|
|
while (JOYISFIRE);
|
|
|
|
mode = oldOldmode;
|
|
|
|
waitForFire = 1;
|
2010-01-14 01:38:15 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef GAME_SNAKE
|
|
|
|
case 46:
|
2011-02-25 04:34:09 +00:00
|
|
|
waitForFire = 0;
|
|
|
|
while (JOYISFIRE);
|
2010-01-14 01:38:15 +00:00
|
|
|
snake_game();
|
2011-02-25 04:34:09 +00:00
|
|
|
while (JOYISFIRE);
|
|
|
|
mode = oldOldmode;
|
|
|
|
waitForFire = 1;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef GAME_BREAKOUT
|
|
|
|
case 47:
|
|
|
|
waitForFire = 0;
|
|
|
|
while (JOYISFIRE);
|
|
|
|
borg_breakout(0);
|
|
|
|
while (JOYISFIRE);
|
|
|
|
mode = oldOldmode;
|
|
|
|
waitForFire = 1;
|
2010-01-14 01:38:15 +00:00
|
|
|
break;
|
|
|
|
#endif
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|