Skip to content

Commit

Permalink
+ added a nice little game - Connect Four (see http://en.wikipedia.or…
Browse files Browse the repository at this point in the history
…g/wiki/Connect_Four )

game was written by CHDKLover & Kettmeister in the german forum, see http://chdk.kernreaktor.org/mantis/view.php?id=106 for more links

note: if we hear of reports that the binary is being to big for some cameras since the introduction of Connect 4, we are likely to disable it in the buildconf.inc (so people can compile it using the chdk shell or maybe another build server)

git-svn-id: http://tools.assembla.com/svn/chdk/trunk@600 6794e30b-3f2a-0410-a806-a2bbca1c07ff
  • Loading branch information
phyrephox committed Nov 29, 2008
1 parent e1bd57b commit 9a8c57f
Show file tree
Hide file tree
Showing 10 changed files with 435 additions and 5 deletions.
9 changes: 8 additions & 1 deletion CHDK/LANG/english.lng
Original file line number Diff line number Diff line change
Expand Up @@ -565,4 +565,11 @@
424 "DNG format"
425 "RAW buffer cached"
426 "Cannot load CHDK/badpixel.bin"
427 "Show raw saving time"
427 "Show raw saving time"
428 "Connect 4"
429 "Opponent:"
430 "Human"
431 "Player 1 won the game"
432 "Player 2 won the game"
433 "I beat you"
434 "The game ended a draw"
10 changes: 9 additions & 1 deletion CHDK/LANG/german.lng
Original file line number Diff line number Diff line change
Expand Up @@ -602,4 +602,12 @@
424 "DNG-Format"
425 "RAW-Puffer nutzen"
426 "Datei badpixel.bin fehlt!"
427 "Zeige raw speicherzeit"
427 "Zeige raw speicherzeit"

428 "4 Gewinnt"
429 "Gegner:"
430 "Mensch"
431 "Spieler 1 hat gewonnen"
432 "Spieler 2 hat gewonnen"
433 "Ich habe gewonnen :-)"
434 "Unentschieden"
1 change: 1 addition & 0 deletions buildconf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ OPT_LUA_IOLIB=1
OPT_LUA_OSLIB=1
OPT_GAME_REVERSI=1
OPT_GAME_SOKOBAN=1
OPT_GAME_CONNECT4=1
OPT_BOOTLOGO=1
OPT_CURVES=1
OPT_TEXTREADER=1
Expand Down
4 changes: 4 additions & 0 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ ifdef OPT_GAME_SOKOBAN
CFLAGS+=-DOPT_GAME_SOKOBAN
OPT_OBJS+=gui_sokoban.o
endif
ifdef OPT_GAME_CONNECT4
CFLAGS+=-DOPT_GAME_CONNECT4
OPT_OBJS+=gui_4wins.o
endif
ifdef OPT_BOOTLOGO
CFLAGS+=-DOPT_BOOTLOGO
endif
Expand Down
32 changes: 31 additions & 1 deletion core/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "gui_mpopup.h"
#include "gui_reversi.h"
#include "gui_sokoban.h"
#include "gui_4wins.h"
#ifdef OPT_DEBUGGING
#include "gui_debug.h"
#endif
Expand Down Expand Up @@ -130,6 +131,7 @@ static void gui_show_memory_info(int arg);
static void gui_draw_palette(int arg);
static void gui_draw_reversi(int arg);
static void gui_draw_sokoban(int arg);
static void gui_draw_4wins(int arg);
#ifdef OPT_DEBUGGING
static void gui_draw_debug(int arg);
static void gui_draw_bench(int arg);
Expand Down Expand Up @@ -317,6 +319,9 @@ static CMenuItem games_submenu_items[] = {
#endif
#ifdef OPT_GAME_SOKOBAN
{0x38,LANG_MENU_GAMES_SOKOBAN, MENUITEM_PROC, (int*)gui_draw_sokoban },
#endif
#ifdef OPT_GAME_CONNECT4
{0x38,LANG_MENU_GAMES_CONNECT4, MENUITEM_PROC, (int*)gui_draw_4wins },
#endif
{0x51,LANG_MENU_BACK, MENUITEM_UP },
{0}
Expand Down Expand Up @@ -382,7 +387,9 @@ static CMenuItem misc_submenu_items[] = {
#ifdef OPT_TEXTREADER
{0x37,LANG_MENU_MISC_TEXT_READER, MENUITEM_SUBMENU, (int*)&reader_submenu },
#endif
#if defined (OPT_GAME_REVERSI) || (OPT_GAME_SOKOBAN || (OPT_GAME_CONNECT4))
{0x38,LANG_MENU_MISC_GAMES, MENUITEM_SUBMENU, (int*)&games_submenu },
#endif
#if CAM_SWIVEL_SCREEN
{0x28,LANG_MENU_MISC_FLASHLIGHT, MENUITEM_BOOL, &conf.flashlight },
#endif
Expand Down Expand Up @@ -2046,6 +2053,11 @@ void gui_redraw()
gui_sokoban_draw();
break;
#endif
#ifdef OPT_GAME_CONNECT4
case GUI_MODE_4WINS:
gui_4wins_draw();
break;
#endif
#ifdef OPT_DEBUGGING
case GUI_MODE_DEBUG:
gui_debug_draw();
Expand Down Expand Up @@ -2083,7 +2095,7 @@ void gui_redraw()
gui_in_redraw = 0;
if ((gui_mode_old != gui_mode && (gui_mode_old != GUI_MODE_NONE && gui_mode_old != GUI_MODE_ALT) && (gui_mode != GUI_MODE_MBOX && gui_mode != GUI_MODE_MPOPUP)) || gui_restore) {
gui_restore = 0;
if (gui_mode != GUI_MODE_REVERSI && gui_mode != GUI_MODE_SOKOBAN)
if (gui_mode != GUI_MODE_REVERSI && gui_mode != GUI_MODE_SOKOBAN && gui_mode != GUI_MODE_4WINS)
draw_restore();
}
}
Expand Down Expand Up @@ -2146,6 +2158,7 @@ void gui_kbd_process()
case GUI_MODE_PALETTE:
case GUI_MODE_REVERSI:
case GUI_MODE_SOKOBAN:
case GUI_MODE_4WINS:
#ifdef OPT_DEBUGGING
case GUI_MODE_DEBUG:
#endif
Expand Down Expand Up @@ -2294,6 +2307,11 @@ void gui_kbd_process()
gui_sokoban_kbd_process();
break;
#endif
#ifdef OPT_GAME_CONNECT4
case GUI_MODE_4WINS:
gui_4wins_kbd_process();
break;
#endif
#ifdef OPT_DEBUGGING
case GUI_MODE_DEBUG:
gui_debug_kbd_process();
Expand Down Expand Up @@ -2806,6 +2824,18 @@ void gui_draw_sokoban(int arg) {
}
#endif
//-------------------------------------------------------------------
#ifdef OPT_GAME_CONNECT4
void gui_draw_4wins(int arg) {
if ((mode_get()&MODE_MASK) != MODE_PLAY) {
gui_mbox_init(LANG_MSG_INFO_TITLE, LANG_MSG_SWITCH_TO_PLAY_MODE,
MBOX_FUNC_RESTORE|MBOX_TEXT_CENTER, NULL);
return;
}
if ( gui_4wins_init() )
gui_mode = GUI_MODE_4WINS;
}
#endif
//-------------------------------------------------------------------
#ifdef OPT_DEBUGGING
void gui_draw_debug(int arg) {
// gui_debug_init(0x2510);
Expand Down
Loading

0 comments on commit 9a8c57f

Please sign in to comment.