Spot the German!

This commit is contained in:
Christian Kroll 2011-11-07 22:35:57 +00:00
parent 7fe76fb14b
commit 1eaaadf509
11 changed files with 96 additions and 85 deletions

View File

@ -1,5 +1,5 @@
OBJ = borg_hw.o main.o util.o pixel.o programm.o borg_can.o can.o \ OBJ = borg_hw.o main.o util.o pixel.o program.o borg_can.o can.o \
spi.o scrolltext3.o font_arial8.o joystick.o snake.o \ spi.o scrolltext3.o font_arial8.o joystick.o snake.o \
eeprom_reserve.o persistentCounter.o prng.o matrix.o \ eeprom_reserve.o persistentCounter.o prng.o matrix.o \
invader_draw.o invader_init.o invader_proc.o invaders2.o \ invader_draw.o invader_init.o invader_proc.o invaders2.o \

View File

@ -3,7 +3,7 @@ TOPDIR = ..
include $(TOPDIR)/defaults.mk include $(TOPDIR)/defaults.mk
SRC = programm.c SRC = program.c
ifeq ($(ANIMATION_SNAKE),y) ifeq ($(ANIMATION_SNAKE),y)
SRC += snake.c SRC += snake.c

View File

@ -1,29 +1,29 @@
mainmenu_option next_comment mainmenu_option next_comment
comment "Animations" comment "Animations"
dep_bool "Scrolltext" ANIMATION_SCROLLTEXT $SCROLLTEXT_SUPPORT dep_bool "Scrolltext" ANIMATION_SCROLLTEXT $SCROLLTEXT_SUPPORT
bool "Spirale" ANIMATION_SPIRALE bool "Spiral" ANIMATION_SPIRAL
bool "Joern1" ANIMATION_JOERN1 bool "Joern1" ANIMATION_JOERN1
dep_bool_menu "Snake" ANIMATION_SNAKE $RANDOM_SUPPORT dep_bool_menu "Snake" ANIMATION_SNAKE $RANDOM_SUPPORT
int "Snake round delay" SNAKE_CYCLE_DELAY 100 int "Snake Round Delay" SNAKE_CYCLE_DELAY 100
int "Snake termination delay" SNAKE_TERMINATION_DELAY 60 int "Snake Termination Delay" SNAKE_TERMINATION_DELAY 60
uint "Snake max length" SNAKE_MAX_LENGTH 64 uint "Snake Max Length" SNAKE_MAX_LENGTH 64
int "Snake max apples" SNAKE_MAX_APPLES 10 int "Snake Max Apples" SNAKE_MAX_APPLES 10
endmenu endmenu
bool "Schachbrett" ANIMATION_SCHACHBRETT bool "Chessboard" ANIMATION_CHESSBOARD
dep_bool_menu "Feuer" ANIMATION_FEUER $RANDOM_SUPPORT dep_bool_menu "Fire" ANIMATION_FIRE $RANDOM_SUPPORT
int "FEUER_S" FEUER_S 30 int "FIRE_S" FIRE_S 30
int "FEUER_N" FEUER_N 5 int "FIRE_N" FIRE_N 5
int "FEUER_DIV" FEUER_DIV 44 int "FIRE_DIV" FIRE_DIV 44
int "FEUER_DELAY" FEUER_DELAY 50 int "FIRE_DELAY" FIRE_DELAY 50
int "Fire number of cycles" FIRE_CYCLES 800 int "Fire Number of Cycles" FIRE_CYCLES 800
endmenu endmenu
dep_bool_menu "Matrix" ANIMATION_MATRIX $RANDOM_SUPPORT dep_bool_menu "Matrix" ANIMATION_MATRIX $RANDOM_SUPPORT
int "Number of streamers" MATRIX_STREAMER_NUM 30 int "Number of Streamers" MATRIX_STREAMER_NUM 30
int "Run for this number of rounds" MATRIX_CYCLES 500 int "Run For This Number of Rounds" MATRIX_CYCLES 500
endmenu endmenu
dep_bool "Random Bright" ANIMATION_RANDOM_BRIGHT $RANDOM_SUPPORT dep_bool "Random Bright" ANIMATION_RANDOM_BRIGHT $RANDOM_SUPPORT
@ -31,8 +31,8 @@ comment "Animations"
dep_bool "Flying Dots" ANIMATION_FLYINGDOTS $RANDOM_SUPPORT dep_bool "Flying Dots" ANIMATION_FLYINGDOTS $RANDOM_SUPPORT
dep_bool_menu "Game of Life" ANIMATION_GAMEOFLIFE $RANDOM_SUPPORT dep_bool_menu "Game of Life" ANIMATION_GAMEOFLIFE $RANDOM_SUPPORT
int "Game of Life round delay (ms)" GOL_DELAY 100 int "Game of Life Round Delay (ms)" GOL_DELAY 100
int "Game of Life max rounds" GOL_CYCLES 360 int "Game of Life Max Rounds" GOL_CYCLES 360
endmenu endmenu
dep_bool "Breakout Demo" ANIMATION_BREAKOUT $GAME_BREAKOUT dep_bool "Breakout Demo" ANIMATION_BREAKOUT $GAME_BREAKOUT
@ -40,8 +40,8 @@ comment "Animations"
dep_bool "Langton Ant" ANIMATION_LTN_ANT $RANDOM_SUPPORT dep_bool "Langton Ant" ANIMATION_LTN_ANT $RANDOM_SUPPORT
dep_bool_menu "Time Display" ANIMATION_TIME $SCROLLTEXT_SUPPORT $LAP_TIME_EXTENSION dep_bool_menu "Time Display" ANIMATION_TIME $SCROLLTEXT_SUPPORT $LAP_TIME_EXTENSION
int "Time master address (int)" TIME_MASTER_ADDR 00 int "Time Master address (int)" TIME_MASTER_ADDR 00
int "Request timeout (ms)" TIME_UPDATE_TIMEOUT 50 int "Request Timeout (ms)" TIME_UPDATE_TIMEOUT 50
endmenu endmenu
dep_bool_menu "Bitmap Scroller" ANIMATION_BMSCROLLER y $RANDOM_SUPPORT dep_bool_menu "Bitmap Scroller" ANIMATION_BMSCROLLER y $RANDOM_SUPPORT

View File

@ -46,7 +46,7 @@ void test_palette2(){
#endif #endif
#ifdef ANIMATION_SPIRALE #ifdef ANIMATION_SPIRAL
static void walk(cursor_t* cur, unsigned char steps, unsigned int delay){ static void walk(cursor_t* cur, unsigned char steps, unsigned int delay){
unsigned char x; unsigned char x;
for(x=steps;x--;){ for(x=steps;x--;){
@ -55,7 +55,7 @@ static void walk(cursor_t* cur, unsigned char steps, unsigned int delay){
} }
} }
void spirale(unsigned int delay){ void spiral(unsigned int delay){
clear_screen(0); clear_screen(0);
cursor_t cur; cursor_t cur;
@ -110,8 +110,8 @@ unsigned char i, j, x;
#endif #endif
#ifdef ANIMATION_SCHACHBRETT #ifdef ANIMATION_CHESSBOARD
void schachbrett(unsigned char times){ void chessboard(unsigned char times){
while (times--) { while (times--) {
for (unsigned char row = 0; row < NUM_ROWS; ++row) { for (unsigned char row = 0; row < NUM_ROWS; ++row) {
for (unsigned char col = 0; col < NUM_COLS; ++col) { for (unsigned char col = 0; col < NUM_COLS; ++col) {
@ -124,41 +124,51 @@ void schachbrett(unsigned char times){
#endif #endif
#ifdef ANIMATION_FEUER #ifdef ANIMATION_FIRE
#ifndef FIRE_CYCLES #ifndef FIRE_CYCLES
#define FIRE_CYCLES 800 #define FIRE_CYCLES 800
#endif #endif
#define FEUER_Y (NUM_ROWS + 3) #define FIRE_Y (NUM_ROWS + 3)
void feuer() void fire()
{ {
unsigned char y, x; unsigned char y, x;
unsigned int t; unsigned int t;
unsigned char world[NUM_COLS][FEUER_Y]; // double buffer unsigned char world[NUM_COLS][FIRE_Y]; // double buffer
for(t=0; t<FIRE_CYCLES; t++) { for (t = 0; t < FIRE_CYCLES; t++) {
// diffuse // diffuse
for(y=1; y<FEUER_Y; y++) { for (y = 1; y < FIRE_Y; y++) {
for(x=1; x<NUM_COLS-1; x++) { for (x = 1; x < NUM_COLS - 1; x++) {
world[x][y-1] = (FEUER_N*world[x-1][y] + FEUER_S*world[x][y] + FEUER_N*world[x+1][y]) / FEUER_DIV; world[x][y - 1] =
(FIRE_N * world[x - 1][y] +
FIRE_S * world[ x][y] +
FIRE_N * world[x + 1][y]) / FIRE_DIV;
}; };
world[0][y-1] = (FEUER_N*world[NUM_COLS-1][y] + FEUER_S*world[0][y] + FEUER_N*world[1][y]) / FEUER_DIV; world[0][y - 1] =
world[NUM_COLS-1][y-1] = (FEUER_N*world[0][y] + FEUER_S*world[NUM_COLS-1][y] + FEUER_N*world[NUM_COLS-2][y]) / FEUER_DIV; (FIRE_N * world[NUM_COLS - 1][y] +
}; FIRE_S * world[ 0][y] +
FIRE_N * world[ 1][y]) / FIRE_DIV;
world[NUM_COLS - 1][y - 1] =
(FIRE_N * world[0 ][y] +
FIRE_S * world[NUM_COLS - 1][y] +
FIRE_N * world[NUM_COLS - 2][y]) / FIRE_DIV;
}
// update lowest line // update lowest line
for(x=0; x<NUM_COLS; x++) { for (x = 0; x < NUM_COLS; x++) {
world[x][FEUER_Y-1] = RANDOM8(); world[x][FIRE_Y - 1] = RANDOM8();
}; }
// copy to screen // copy to screen
for(y=0; y<NUM_ROWS; y++) { for (y = 0; y < NUM_ROWS; y++) {
for(x=0; x<NUM_COLS; x++) { for (x = 0; x < NUM_COLS; x++) {
setpixel( (pixel){x,y}, (world[x][y] >> 5) ); setpixel((pixel) {x,y}, world[x][y] >> 5);
}
} }
};
wait(FEUER_DELAY); wait(FIRE_DELAY);
} }
} }
#endif #endif

View File

@ -20,10 +20,10 @@ inline static void off()
} }
#endif #endif
void spirale(unsigned int delay); void spiral(unsigned int delay);
void joern1(); void joern1();
void schachbrett(unsigned char times); void chessboard(unsigned char times);
void feuer(); void fire();
void random_bright(unsigned cycles); void random_bright(unsigned cycles);
#endif /* PROGRAMM_H_ */ #endif /* PROGRAMM_H_ */

View File

@ -48,7 +48,7 @@ source can/config.in
### Borg Menu ################################################################# ### Borg Menu #################################################################
dep_bool "menu support" MENU_SUPPORT $JOYSTICK_SUPPORT dep_bool "Menu Support" MENU_SUPPORT $JOYSTICK_SUPPORT
depends on JOYSTICK_SUPPORT depends on JOYSTICK_SUPPORT
############################################################################### ###############################################################################
@ -62,6 +62,7 @@ source games/config.in
source animations/config.in source animations/config.in
############################################################################### ###############################################################################
### small Animations Menu ###########################################################
### small Animations Menu #####################################################
source smallani/config.in source smallani/config.in
############################################################################### ###############################################################################

View File

@ -5,7 +5,7 @@
#include "config.h" #include "config.h"
#include "scrolltext/scrolltext.h" #include "scrolltext/scrolltext.h"
#include "animations/snake.h" #include "animations/snake.h"
#include "animations/programm.h" #include "animations/program.h"
#include "animations/matrix.h" #include "animations/matrix.h"
#include "animations/gameoflife.h" #include "animations/gameoflife.h"
#include "animations/stonefly.h" #include "animations/stonefly.h"
@ -95,9 +95,9 @@ void display_loop(){
#endif #endif
#endif #endif
#ifdef ANIMATION_SPIRALE #ifdef ANIMATION_SPIRAL
case 2: case 2:
spirale(5); spiral(5);
break; break;
#endif #endif
@ -113,15 +113,15 @@ void display_loop(){
break; break;
#endif #endif
#ifdef ANIMATION_SCHACHBRETT #ifdef ANIMATION_CHESSBOARD
case 5: case 5:
schachbrett(20); chessboard(20);
break; break;
#endif #endif
#ifdef ANIMATION_FEUER #ifdef ANIMATION_FIRE
case 6: case 6:
feuer(); fire();
break; break;
#endif #endif

View File

@ -72,19 +72,19 @@ GAME_SNAKE=y
# Animations # Animations
# #
ANIMATION_SCROLLTEXT=y ANIMATION_SCROLLTEXT=y
ANIMATION_SPIRALE=y ANIMATION_SPIRAL=y
ANIMATION_JOERN1=y ANIMATION_JOERN1=y
ANIMATION_SNAKE=y ANIMATION_SNAKE=y
SNAKE_CYCLE_DELAY=100 SNAKE_CYCLE_DELAY=100
SNAKE_TERMINATION_DELAY=60 SNAKE_TERMINATION_DELAY=60
SNAKE_MAX_LENGTH=64 SNAKE_MAX_LENGTH=64
SNAKE_MAX_APPLES=10 SNAKE_MAX_APPLES=10
ANIMATION_SCHACHBRETT=y ANIMATION_CHESSBOARD=y
ANIMATION_FEUER=y ANIMATION_FIRE=y
FEUER_S=30 FIRE_S=30
FEUER_N=5 FIRE_N=5
FEUER_DIV=44 FIRE_DIV=44
FEUER_DELAY=50 FIRE_DELAY=50
FIRE_CYCLES=800 FIRE_CYCLES=800
ANIMATION_MATRIX=y ANIMATION_MATRIX=y
MATRIX_STREAMER_NUM=30 MATRIX_STREAMER_NUM=30

View File

@ -69,19 +69,19 @@ GAME_BREAKOUT=y
# Animations # Animations
# #
ANIMATION_SCROLLTEXT=y ANIMATION_SCROLLTEXT=y
ANIMATION_SPIRALE=y ANIMATION_SPIRAL=y
ANIMATION_JOERN1=y ANIMATION_JOERN1=y
ANIMATION_SNAKE=y ANIMATION_SNAKE=y
SNAKE_CYCLE_DELAY=100 SNAKE_CYCLE_DELAY=100
SNAKE_TERMINATION_DELAY=60 SNAKE_TERMINATION_DELAY=60
SNAKE_MAX_LENGTH=64 SNAKE_MAX_LENGTH=64
SNAKE_MAX_APPLES=10 SNAKE_MAX_APPLES=10
ANIMATION_SCHACHBRETT=y ANIMATION_CHESSBOARD=y
ANIMATION_FEUER=y ANIMATION_FIRE=y
FEUER_S=30 FIRE_S=30
FEUER_N=5 FIRE_N=5
FEUER_DIV=44 FIRE_DIV=44
FEUER_DELAY=50 FIRE_DELAY=50
FIRE_CYCLES=800 FIRE_CYCLES=800
ANIMATION_MATRIX=y ANIMATION_MATRIX=y
MATRIX_STREAMER_NUM=30 MATRIX_STREAMER_NUM=30

View File

@ -64,19 +64,19 @@ SPI_PIN_MCP_INT=2
# Animations # Animations
# #
ANIMATION_SCROLLTEXT=y ANIMATION_SCROLLTEXT=y
ANIMATION_SPIRALE=y ANIMATION_SPIRAL=y
ANIMATION_JOERN1=y ANIMATION_JOERN1=y
ANIMATION_SNAKE=y ANIMATION_SNAKE=y
SNAKE_CYCLE_DELAY=50 SNAKE_CYCLE_DELAY=50
SNAKE_TERMINATION_DELAY=60 SNAKE_TERMINATION_DELAY=60
SNAKE_MAX_LENGTH=64 SNAKE_MAX_LENGTH=64
SNAKE_MAX_APPLES=10 SNAKE_MAX_APPLES=10
ANIMATION_SCHACHBRETT=y ANIMATION_CHESSBOARD=y
ANIMATION_FEUER=y ANIMATION_FIRE=y
FEUER_S=30 FIRE_S=30
FEUER_N=5 FIRE_N=5
FEUER_DIV=47 FIRE_DIV=47
FEUER_DELAY=30 FIRE_DELAY=30
FIRE_CYCLES=200 FIRE_CYCLES=200
ANIMATION_MATRIX=y ANIMATION_MATRIX=y
MATRIX_STREAMER_NUM=30 MATRIX_STREAMER_NUM=30

View File

@ -11,7 +11,7 @@ override LDFLAGS = -Wl --prebind
OBJ = breakpoint.o font_arial8.o font_small6.o font_uni53.o invader_draw.o \ OBJ = breakpoint.o font_arial8.o font_small6.o font_uni53.o invader_draw.o \
invader_init.o invader_proc.o invaders2.o joystick.o main.o menu.o pixel.o \ invader_init.o invader_proc.o invaders2.o joystick.o main.o menu.o pixel.o \
programm.o scrolltext3.o snake.o trackball.o util.o tetris/input.o \ program.o scrolltext3.o snake.o trackball.o util.o tetris/input.o \
tetris/logic.o tetris/piece.o tetris/playfield.o tetris/view.o tetris/logic.o tetris/piece.o tetris/playfield.o tetris/view.o
all: Makefile.osx $(APP) all: Makefile.osx $(APP)
@ -56,7 +56,7 @@ invaders2.o: invaders2.c util.h invaders2.h pixel.h config.h scrolltext.h \
joystick.o: joystick.c joystick.h joystick.o: joystick.c joystick.h
$(CC) $(CFLAGS) -c -o joystick.o joystick.c $(CC) $(CFLAGS) -c -o joystick.o joystick.c
main.o: main.c config.h pixel.h util.h programm.h menu.h tetris/logic.h \ main.o: main.c config.h pixel.h util.h program.h menu.h tetris/logic.h \
tetris/piece.h trackball.h snake.h scrolltext.h tetris/piece.h trackball.h snake.h scrolltext.h
$(CC) $(CFLAGS) -c -o main.o main.c $(CC) $(CFLAGS) -c -o main.o main.c
@ -67,8 +67,8 @@ menu.o: menu.c menu.h config.h util.h pixel.h joystick.h snake.h \
pixel.o: pixel.c pixel.h util.h config.h pixel.o: pixel.c pixel.h util.h config.h
$(CC) $(CFLAGS) -c -o pixel.o pixel.c $(CC) $(CFLAGS) -c -o pixel.o pixel.c
programm.o: programm.c pixel.h util.h config.h programm.h joystick.h program.o: program.c pixel.h util.h config.h program.h joystick.h
$(CC) $(CFLAGS) -c -o programm.o programm.c $(CC) $(CFLAGS) -c -o program.o program.c
scrolltext3.o: scrolltext3.c config.h scrolltext.h pixel.h util.h \ scrolltext3.o: scrolltext3.c config.h scrolltext.h pixel.h util.h \
font_arial8.h font.h font_small6.h font_uni53.h font_arial8.h font.h font_small6.h font_uni53.h