Changeset 600


Ignore:
Timestamp:
11/29/08 17:40:07 (4 years ago)
Author:
phyrephox
Message:

+ added a nice little game - Connect Four (see http://en.wikipedia.org/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)

Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/CHDK/LANG/english.lng

    r593 r600  
    567567426 "Cannot load CHDK/badpixel.bin" 
    568568427 "Show raw saving time" 
     569428 "Connect 4" 
     570429 "Opponent:" 
     571430 "Human" 
     572431 "Player 1 won the game" 
     573432 "Player 2 won the game" 
     574433 "I beat you" 
     575434 "The game ended a draw" 
  • trunk/CHDK/LANG/german.lng

    r593 r600  
    604604426 "Datei badpixel.bin fehlt!" 
    605605427 "Zeige raw speicherzeit" 
     606 
     607428 "4 Gewinnt" 
     608429 "Gegner:" 
     609430 "Mensch" 
     610431 "Spieler 1 hat gewonnen" 
     611432 "Spieler 2 hat gewonnen" 
     612433 "Ich habe gewonnen :-)" 
     613434 "Unentschieden" 
  • trunk/buildconf.inc

    r553 r600  
    44OPT_GAME_REVERSI=1 
    55OPT_GAME_SOKOBAN=1 
     6OPT_GAME_CONNECT4=1 
    67OPT_BOOTLOGO=1 
    78OPT_CURVES=1 
  • trunk/core/Makefile

    r590 r600  
    2020CFLAGS+=-DOPT_GAME_SOKOBAN 
    2121OPT_OBJS+=gui_sokoban.o 
     22endif 
     23ifdef OPT_GAME_CONNECT4 
     24CFLAGS+=-DOPT_GAME_CONNECT4 
     25OPT_OBJS+=gui_4wins.o 
    2226endif 
    2327ifdef OPT_BOOTLOGO 
  • trunk/core/gui.c

    r598 r600  
    1717#include "gui_reversi.h" 
    1818#include "gui_sokoban.h" 
     19#include "gui_4wins.h" 
    1920#ifdef OPT_DEBUGGING 
    2021#include "gui_debug.h" 
     
    131132static void gui_draw_reversi(int arg); 
    132133static void gui_draw_sokoban(int arg); 
     134static void gui_draw_4wins(int arg); 
    133135#ifdef OPT_DEBUGGING 
    134136        static void gui_draw_debug(int arg); 
     
    319321    {0x38,LANG_MENU_GAMES_SOKOBAN,           MENUITEM_PROC,  (int*)gui_draw_sokoban }, 
    320322#endif 
     323#ifdef OPT_GAME_CONNECT4 
     324    {0x38,LANG_MENU_GAMES_CONNECT4,             MENUITEM_PROC,  (int*)gui_draw_4wins }, 
     325#endif 
    321326    {0x51,LANG_MENU_BACK,                    MENUITEM_UP }, 
    322327    {0} 
     
    383388    {0x37,LANG_MENU_MISC_TEXT_READER,        MENUITEM_SUBMENU, (int*)&reader_submenu }, 
    384389#endif 
     390#if defined (OPT_GAME_REVERSI) || (OPT_GAME_SOKOBAN || (OPT_GAME_CONNECT4)) 
    385391    {0x38,LANG_MENU_MISC_GAMES,              MENUITEM_SUBMENU, (int*)&games_submenu }, 
     392#endif 
    386393#if CAM_SWIVEL_SCREEN 
    387394    {0x28,LANG_MENU_MISC_FLASHLIGHT,         MENUITEM_BOOL,    &conf.flashlight }, 
     
    20472054            break; 
    20482055#endif 
     2056#ifdef OPT_GAME_CONNECT4 
     2057        case GUI_MODE_4WINS: 
     2058            gui_4wins_draw(); 
     2059            break; 
     2060#endif 
    20492061#ifdef OPT_DEBUGGING 
    20502062        case GUI_MODE_DEBUG: 
     
    20842096    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) { 
    20852097        gui_restore = 0; 
    2086         if (gui_mode != GUI_MODE_REVERSI && gui_mode != GUI_MODE_SOKOBAN) 
     2098        if (gui_mode != GUI_MODE_REVERSI && gui_mode != GUI_MODE_SOKOBAN && gui_mode != GUI_MODE_4WINS) 
    20872099            draw_restore(); 
    20882100    } 
     
    21472159            case GUI_MODE_REVERSI: 
    21482160            case GUI_MODE_SOKOBAN: 
     2161            case GUI_MODE_4WINS: 
    21492162#ifdef OPT_DEBUGGING 
    21502163            case GUI_MODE_DEBUG: 
     
    22952308            break; 
    22962309#endif 
     2310#ifdef OPT_GAME_CONNECT4 
     2311        case GUI_MODE_4WINS: 
     2312            gui_4wins_kbd_process(); 
     2313            break; 
     2314#endif 
    22972315#ifdef OPT_DEBUGGING 
    22982316        case GUI_MODE_DEBUG: 
     
    28072825#endif 
    28082826//------------------------------------------------------------------- 
     2827#ifdef OPT_GAME_CONNECT4 
     2828void gui_draw_4wins(int arg) { 
     2829    if ((mode_get()&MODE_MASK) != MODE_PLAY) { 
     2830        gui_mbox_init(LANG_MSG_INFO_TITLE, LANG_MSG_SWITCH_TO_PLAY_MODE, 
     2831                      MBOX_FUNC_RESTORE|MBOX_TEXT_CENTER, NULL); 
     2832        return; 
     2833    } 
     2834    if ( gui_4wins_init() ) 
     2835        gui_mode = GUI_MODE_4WINS; 
     2836} 
     2837#endif 
     2838//------------------------------------------------------------------- 
    28092839#ifdef OPT_DEBUGGING 
    28102840void gui_draw_debug(int arg) { 
  • trunk/core/gui_lang.c

    r593 r600  
    547547"426 \"Cannot load CHDK/badpixel.bin\"\n" 
    548548"427 \"Show saving time\"\n" 
     549 
     550"428 \"Connect 4\"\n" 
     551"429 \"Opponent:\"\n" 
     552"430 \"Human\"\n" 
     553"431 \"Player 1 won the game\"\n" 
     554"432 \"Player 2 won the game\"\n" 
     555"433 \"I beat you\"\n" 
     556"434 \"The game ended a draw\"\n" 
    549557; 
    550558 
  • trunk/core/gui_lang.h

    r593 r600  
    536536#define LANG_CANNOT_OPEN_BADPIXEL_FILE  426 
    537537#define LANG_MENU_RAW_TIMER             427 
     538 
     539#define LANG_MENU_GAMES_CONNECT4           428 
     540#define LANG_CONNECT4_RIVAL                 429 
     541#define LANG_CONNECT4_HUMAN                430 
     542#define LANG_CONNECT4_P1_WIN               431 
     543#define LANG_CONNECT4_P2_WIN               432 
     544#define LANG_CONNECT4_CAM_WIN              433 
     545#define LANG_CONNECT4_DRAW                 434 
    538546//------------------------------------------------------------------- 
    539547 
    540 #define GUI_LANG_ITEMS                  427 
     548#define GUI_LANG_ITEMS                  434 
    541549 
    542550//------------------------------------------------------------------- 
  • trunk/include/gui.h

    r515 r600  
    2020                GUI_MODE_CALENDAR, 
    2121                GUI_MODE_BENCH, 
    22                 GUI_MODE_MPOPUP }; 
     22                GUI_MODE_MPOPUP, 
     23                GUI_MODE_4WINS }; 
    2324 
    2425extern void gui_redraw(); 
Note: See TracChangeset for help on using the changeset viewer.