Thread: [rogueclone-cvs] rogue/src curses.c, 1.11.2.1, 1.11.2.2 rogue.h, 1.9.2.1, 1.9.2.2
Brought to you by:
mlehotay
From: Michael L. <mle...@us...> - 2008-06-19 02:49:59
|
Update of /cvsroot/rogueclone/rogue/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv9641 Modified Files: Tag: curses curses.c rogue.h Log Message: #ifdef ROGUECURSES for broken curses code Index: rogue.h =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/rogue.h,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 *** rogue.h 18 Jun 2008 03:16:13 -0000 1.9.2.1 --- rogue.h 19 Jun 2008 02:49:54 -0000 1.9.2.2 *************** *** 44,47 **** --- 44,60 ---- */ + + /***************************************************************************** + * CONFIGURATION MACROS * + *****************************************************************************/ + + /* #define ROGUECURSES */ + /* #define DISCOVERY */ + #define KNOWN_ITEMS + /* #define ONE_SCORE */ + + /*****************************************************************************/ + + #ifdef _MSC_VER /* supress warnings about parameters and return values, *************** *** 226,238 **** }; ! #ifdef HAVECURSES ! #ifdef __MSDOS__ ! #define DOS /* kludge for pdcurses */ ! #endif ! #include "curses.h" ! ! #define COLOR_STAIRS COLOR_WHITE+1 - #else extern int LINES, COLS; typedef unsigned short chtype; /* 8-bit attr + 8-bit char */ --- 239,244 ---- }; ! #ifdef ROGUECURSES extern int LINES, COLS; typedef unsigned short chtype; /* 8-bit attr + 8-bit char */ *************** *** 278,284 **** #define BGCOLOR_OF(col) (byte)(((col) >> 4) & 0x0F) #define FGCOLOR_OF(col) (byte)((col) & 0x0F) ! #endif ! #endif /* !HAVECURSES */ --- 284,299 ---- #define BGCOLOR_OF(col) (byte)(((col) >> 4) & 0x0F) #define FGCOLOR_OF(col) (byte)((col) & 0x0F) ! #endif /* Support for color GUI...*/ ! #else /* link with pdcurses. maybe other curses would work too? */ ! ! #ifdef __MSDOS__ ! #define DOS /* kludge for pdcurses */ ! #endif ! #include "curses.h" ! ! #define COLOR_STAIRS COLOR_WHITE+1 ! ! #endif /* ROGUECURSES */ *************** *** 594,598 **** /* curses.c */ char rgetchar(void); ! #ifndef HAVECURSES void initscr(void); void move(const short row, const short col); --- 609,613 ---- /* curses.c */ char rgetchar(void); ! #ifdef ROGUECURSES void initscr(void); void move(const short row, const short col); *************** *** 608,612 **** void refresh(void); void redraw(void); ! int mvinch(const short row, const short col); chtype mvincch(const short row, const short col); void clear(void); --- 623,627 ---- void refresh(void); void redraw(void); ! /* int mvinch(const short row, const short col); */ chtype mvincch(const short row, const short col); void clear(void); *************** *** 619,623 **** void noecho(void); void nonl(void); ! #endif /* hit.c */ --- 634,638 ---- void noecho(void); void nonl(void); ! #endif /* ROGUECURSES */ /* hit.c */ Index: curses.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/curses.c,v retrieving revision 1.11.2.1 retrieving revision 1.11.2.2 diff -C2 -d -r1.11.2.1 -r1.11.2.2 *** curses.c 18 Jun 2008 03:16:13 -0000 1.11.2.1 --- curses.c 19 Jun 2008 02:49:54 -0000 1.11.2.2 *************** *** 46,63 **** /* - * patch [ 1176457 ] curses support (very preliminary) -ML - * - * to build with visual studio: - * 1. download pdcurses from - * http://voxel.dl.sourceforge.net/sourceforge/pdcurses/pdc33dll.zip - * 2. the zip file contains 4 files. put the dll in your sys\debug directory - * 3. create a sys\pdcurses directory and put the other three files there - * 4. add /D "HAVECURSES" /I../sys/pdcurses to your project options in - * Project | Settings | C/C++ from the visual studio menu - * 5. add ../sys/pdcurses/pdcurses.lib to your object/library modules in - * Project | Settings | Link from the visual studio menu - */ - - /* * ML, 31 Jan 2004: added support for win32 console applications * --- 46,49 ---- *************** *** 86,170 **** #include "rogue.h" - #ifndef HAVECURSES /* curses isn't available, so use our own UI code */ - - #include <stdio.h> - - /* ============== COMPILER-SPECIFIC CONSTANTS AND TYPEDEFS =============== */ - - #ifdef __WATCOMC__ - - #include <dos.h> - typedef union REGPACK regs_t; - #define intr_fn(N,R) intr(N,R) - - #elif _MSC_VER /* Microsoft C (tested with VC98) */ - - #define WIN32_LEAN_AND_MEAN - #include <windows.h> - - #elif __DJGPP__ - - #include <dpmi.h> - typedef __dpmi_regs regs_t; - #define intr_fn(N,R) __dpmi_int(N,R) - - #else - #error curses.c only compiles with Open Watcom, Microsoft C, or DJGPP - #endif - - /* ============== CONSTANTS AND TYPEDEFS =============== */ - - struct _win_st { - short _cury, _curx; - short _maxy, _maxx; - }; - typedef struct _win_st WINDOW; - - - typedef union _colorChar COLORBUF; - #define BLANKCH MAKE_COLOR_CHAR(WHITE,BLACK,' ') - - - - /* ================== GLOBAL VARIABLES ================== */ - - int LINES=DROWS, COLS=DCOLS; - - /* static char terminal[DROWS][DCOLS]; */ - /* static char buffer[DROWS][DCOLS]; */ - static COLORBUF terminal[DROWS][DCOLS]; - static COLORBUF buffer[DROWS][DCOLS]; - - static boolean screen_dirty; - static boolean lines_dirty[DROWS]; - static boolean buf_stand_out = 0; - - static WINDOW scr_buf; - static WINDOW *curscr = &scr_buf; - static short cur_row, cur_col; - - #ifdef _MSC_VER - static HANDLE hStdIn, hStdOut; - #else - static unsigned char videomode, videopage; - #endif - - /* ================= PRIVATE PROTOTYPES ================= */ - - static void addstr_in_color(char *str, const byte color); /* only used within this file */ - static void addcstr(chtype *cstr); /* only used within this file */ - static char translate_keypad(int scancode); /* only used within this file */ - /* static void put_char_at(int row, int col, char ch) only used within this file*/ - static void put_color_char_at(int row, int col, COLORBUF cb); /* only used within this file */ - static void put_cursor(int row, int col); /* only used within this file */ - static void clear_buffers(void); /* only used within this file */ - static void cls(void); /* only uwed within this file */ - static void wrefresh(WINDOW *scr); /* only used within this file */ - - - /* ================== PUBLIC FUNCTIONS ================== */ - - #endif /* !HAVECURSES */ - /* Returns a keystroke, translated into a Rogue command. */ --- 72,75 ---- *************** *** 173,177 **** { char ch; ! #ifndef HAVECURSES #ifdef _MSC_VER INPUT_RECORD ir; --- 78,82 ---- { char ch; ! #ifdef ROGUECURSES #ifdef _MSC_VER INPUT_RECORD ir; *************** *** 183,192 **** regs_t regs; #endif ! #endif for(;;) { - #ifdef HAVECURSES ch = getch(); ! #elif defined(_MSC_VER) && !defined(HAVECURSES) if(!ReadConsoleInput(hStdIn, &ir, 1, &n) || ir.EventType != KEY_EVENT || !ir.Event.KeyEvent.bKeyDown) --- 88,98 ---- regs_t regs; #endif ! #endif /* ROGUECURSES */ for(;;) { ch = getch(); ! ! #ifdef ROGUECURSES ! #ifdef _MSC_VER if(!ReadConsoleInput(hStdIn, &ir, 1, &n) || ir.EventType != KEY_EVENT || !ir.Event.KeyEvent.bKeyDown) *************** *** 253,256 **** --- 159,164 ---- ch = regs.h.al; /* ASCII code */ #endif + #endif /* ROGUECURSES */ + switch(ch) { case '\022': /* ^R */ *************** *** 266,270 **** } ! #ifndef HAVECURSES /* Initializes the screen and pulls in the DPMI mode and page in use --- 174,256 ---- } ! ! ! #ifdef ROGUECURSES ! ! #include <stdio.h> ! ! /* ============== COMPILER-SPECIFIC CONSTANTS AND TYPEDEFS =============== */ ! ! #ifdef __WATCOMC__ ! ! #include <dos.h> ! typedef union REGPACK regs_t; ! #define intr_fn(N,R) intr(N,R) ! ! #elif _MSC_VER /* Microsoft C (tested with VC98) */ ! ! #define WIN32_LEAN_AND_MEAN ! #include <windows.h> ! ! #elif __DJGPP__ ! ! #include <dpmi.h> ! typedef __dpmi_regs regs_t; ! #define intr_fn(N,R) __dpmi_int(N,R) ! ! #else ! #error curses.c only compiles with Open Watcom, Microsoft C, or DJGPP ! #endif ! ! /* ============== CONSTANTS AND TYPEDEFS =============== */ ! ! struct _win_st { ! short _cury, _curx; ! short _maxy, _maxx; ! }; ! typedef struct _win_st WINDOW; ! ! ! typedef union _colorChar COLORBUF; ! #define BLANKCH MAKE_COLOR_CHAR(WHITE,BLACK,' ') ! ! ! ! /* ================== GLOBAL VARIABLES ================== */ ! ! int LINES=DROWS, COLS=DCOLS; ! ! /* static char terminal[DROWS][DCOLS]; */ ! /* static char buffer[DROWS][DCOLS]; */ ! static COLORBUF terminal[DROWS][DCOLS]; ! static COLORBUF buffer[DROWS][DCOLS]; ! ! static boolean screen_dirty; ! static boolean lines_dirty[DROWS]; ! static boolean buf_stand_out = 0; ! ! static WINDOW scr_buf; ! static WINDOW *curscr = &scr_buf; ! static short cur_row, cur_col; ! ! #ifdef _MSC_VER ! static HANDLE hStdIn, hStdOut; ! #else ! static unsigned char videomode, videopage; ! #endif ! ! /* ================= PRIVATE PROTOTYPES ================= */ ! ! static void addstr_in_color(char *str, const byte color); /* only used within this file */ ! static void addcstr(chtype *cstr); /* only used within this file */ ! static char translate_keypad(int scancode); /* only used within this file */ ! /* static void put_char_at(int row, int col, char ch) only used within this file*/ ! static void put_color_char_at(int row, int col, COLORBUF cb); /* only used within this file */ ! static void put_cursor(int row, int col); /* only used within this file */ ! static void clear_buffers(void); /* only used within this file */ ! static void cls(void); /* only uwed within this file */ ! static void wrefresh(WINDOW *scr); /* only used within this file */ ! ! /* ================== PUBLIC FUNCTIONS ================== */ /* Initializes the screen and pulls in the DPMI mode and page in use *************** *** 808,810 **** } ! #endif /* !HAVECURSES */ --- 794,796 ---- } ! #endif /* ROGUECURSES */ |