[rogueclone-cvs] rogue/src curses.c, 1.11, 1.11.2.1 hit.c, 1.6, 1.6.2.1 init.c, 1.9, 1.9.2.1 invent
Brought to you by:
mlehotay
From: Michael L. <mle...@us...> - 2008-06-18 03:16:20
|
Update of /cvsroot/rogueclone/rogue/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10465 Modified Files: Tag: curses curses.c hit.c init.c invent.c level.c machdep.c message.c monster.c move.c object.c rogue.h room.c save.c score.c spec_hit.c throw.c trap.c use.c zap.c Log Message: applied patch [ 1176457 ] curses support (very preliminary) Index: score.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/score.c,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** score.c 13 Jun 2008 00:19:06 -0000 1.7 --- score.c 18 Jun 2008 03:16:13 -0000 1.7.2.1 *************** *** 61,65 **** static int name_cmp(char *s1, char *s2); /* only used within this file */ static void center(const short row, char *buf); /* only used within this file */ ! static void center_in_color(const short row, char *buf, const byte color); /* only used within this file */ static void sf_error(void); /* only used within this file */ --- 61,65 ---- static int name_cmp(char *s1, char *s2); /* only used within this file */ static void center(const short row, char *buf); /* only used within this file */ ! static void center_in_color(const short row, char *buf, attr_t color); /* only used within this file */ static void sf_error(void); /* only used within this file */ *************** *** 72,76 **** char buf[128]; char gold[128]; - color_char boxchars[6]; md_ignore_signals(); --- 72,75 ---- *************** *** 136,147 **** } else {/* modern tombstone, pulled from PC-Rogue with apologies */ ! boxchars[0] = get_terrain_char(HORWALL); ! boxchars[1] = get_terrain_char(VERTWALL); ! boxchars[2] = get_terrain_char(ULCORNER); ! boxchars[3] = get_terrain_char(URCORNER); ! boxchars[4] = get_terrain_char(LLCORNER); ! boxchars[5] = get_terrain_char(LRCORNER); - draw_box(boxchars, 4, 25, 19, 30); center( 8, "R E S T"); center( 9, "I N"); --- 135,155 ---- } else {/* modern tombstone, pulled from PC-Rogue with apologies */ ! short i; ! chtype horz = get_terrain_char(HORWALL); ! chtype vert = get_terrain_char(VERTWALL); ! ! for (i = 26; i < 54; i++) { ! mvaddch(4, i, horz); ! mvaddch(22, i, horz); ! } ! for (i = 5; i < 22; i++) { ! mvaddch(i, 25, vert); ! mvaddch(i, 54, vert); ! } ! mvaddch(4, 25, get_terrain_char(ULCORNER)); ! mvaddch(4, 54, get_terrain_char(URCORNER)); ! mvaddch(22, 25, get_terrain_char(LLCORNER)); ! mvaddch(22, 54, get_terrain_char(LRCORNER)); center( 8, "R E S T"); center( 9, "I N"); *************** *** 151,157 **** center(16, gold); /* NS: ought to put the date here for effect. */ ! center_in_color(21, " * * * ", MAKE_COLOR(RED,BLACK)); center_in_color(22, "___\\/(\\/)/(\\/ \\\\(//)\\)\\/(//)\\\\)//(\\__", ! MAKE_COLOR(GREEN,BLACK)); } } else { --- 159,165 ---- center(16, gold); /* NS: ought to put the date here for effect. */ ! center_in_color(21, " * * * ", COLOR_PAIR(COLOR_RED)); center_in_color(22, "___\\/(\\/)/(\\/ \\\\(//)\\)\\/(//)\\\\)//(\\__", ! COLOR_PAIR(COLOR_GREEN)); } } else { *************** *** 561,575 **** static void center(const short row, char *buf) /* only used within this file */ { ! center_in_color(row, buf, MAKE_COLOR(WHITE,BLACK)); } ! static void center_in_color(const short row, char *buf, const byte color) /* only used within this file */ { short margin; margin = (short) ((DCOLS - strlen(buf)) / 2); ! mvaddstr_in_color(row, margin, buf, ! (unsigned char) ((use_color) ? color : MAKE_COLOR(WHITE,BLACK))); } --- 569,585 ---- static void center(const short row, char *buf) /* only used within this file */ { ! center_in_color(row, buf, COLOR_PAIR(COLOR_WHITE)); } ! static void center_in_color(const short row, char *buf, attr_t color) /* only used within this file */ { short margin; margin = (short) ((DCOLS - strlen(buf)) / 2); ! ! attron(use_color ? color : COLOR_PAIR(COLOR_WHITE)); ! mvaddstr(row, margin, buf); ! attroff(use_color ? color : COLOR_PAIR(COLOR_WHITE)); } Index: use.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/use.c,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** use.c 16 Jun 2008 04:42:04 -0000 1.8 --- use.c 18 Jun 2008 03:16:14 -0000 1.8.2.1 *************** *** 494,498 **** void tele(void) { ! mvaddcch(rogue.row, rogue.col, get_dungeon_char(rogue.row, rogue.col)); if (cur_room >= 0) { --- 494,498 ---- void tele(void) { ! mvaddch(rogue.row, rogue.col, get_dungeon_char(rogue.row, rogue.col)); if (cur_room >= 0) { *************** *** 510,514 **** short ch; static char steadychars[10] = ""; ! color_char cch; if (blind) return; --- 510,514 ---- short ch; static char steadychars[10] = ""; ! chtype cch; if (blind) return; *************** *** 521,528 **** */ if (steadychars[0] == '\0') { ! steadychars[0] = get_terrain_char(NOTHING).b8.ch; ! steadychars[1] = get_terrain_char(FLOOR).b8.ch; ! steadychars[2] = get_terrain_char(TUNNEL).b8.ch; ! steadychars[3] = get_terrain_char(DOOR).b8.ch; steadychars[4] = '\0'; } --- 521,528 ---- */ if (steadychars[0] == '\0') { ! steadychars[0] = (char) (get_terrain_char(NOTHING) | A_CHARTEXT); ! steadychars[1] = (char) (get_terrain_char(FLOOR) | A_CHARTEXT); ! steadychars[2] = (char) (get_terrain_char(TUNNEL) | A_CHARTEXT); ! steadychars[3] = (char) (get_terrain_char(DOOR) | A_CHARTEXT); steadychars[4] = '\0'; } *************** *** 535,543 **** /* if ((ch != ' ') && (ch != '.') && (ch != '\xB1') && (ch != '+')) { */ if (strchr(steadychars, ch) == 0) { ! cch.b16 = gr_obj_char(-1).b16; if (!use_color) { ! cch.b8.color = MAKE_COLOR(WHITE,BLACK); } ! addcch(cch); } obj = obj->next_object; --- 535,543 ---- /* if ((ch != ' ') && (ch != '.') && (ch != '\xB1') && (ch != '+')) { */ if (strchr(steadychars, ch) == 0) { ! cch = gr_obj_char(-1); if (!use_color) { ! cch |= COLOR_PAIR(COLOR_WHITE); } ! addch(cch); } obj = obj->next_object; *************** *** 584,588 **** light_up_room(cur_room); } ! mvaddcch(rogue.row, rogue.col, get_rogue_char()); } --- 584,588 ---- light_up_room(cur_room); } ! mvaddch(rogue.row, rogue.col, get_rogue_char()); } *************** *** 618,622 **** while (monster) { ! mvaddcch(monster->row, monster->col, monster->trail_char); monster = monster->next_monster; } --- 618,622 ---- while (monster) { ! mvaddch(monster->row, monster->col, monster->trail_char); monster = monster->next_monster; } *************** *** 631,635 **** } } ! mvaddcch(rogue.row, rogue.col, get_rogue_char()); } --- 631,635 ---- } } ! mvaddch(rogue.row, rogue.col, get_rogue_char()); } Index: room.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/room.c,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** room.c 14 Jun 2008 02:38:02 -0000 1.11 --- room.c 18 Jun 2008 03:16:13 -0000 1.11.2.1 *************** *** 53,57 **** extern short halluc; extern boolean detect_monster, jump, passgo, display_skull; ! extern boolean use_doschars, use_color, beep; extern char *login_name, *fruit, *press_space; --- 53,57 ---- extern short halluc; extern boolean detect_monster, jump, passgo, display_skull; ! extern boolean use_doschars, use_color, use_bell; extern char *login_name, *fruit, *press_space; *************** *** 92,96 **** { "Use the terminal bell (\"beep\"): ", ! 1, (char **) 0, &beep, 0, 0 }, { --- 92,96 ---- { "Use the terminal bell (\"beep\"): ", ! 1, (char **) 0, &use_bell, 0, 0 }, { *************** *** 110,147 **** struct _screenchars { unsigned short mask; /* as defined in rogue.h */ ! char ch; /* classic screen character */ ! char dosch; /* DOS screen character */ ! unsigned char fgcolor; /* foreground color */ ! unsigned char bgcolor; /* background color */ boolean canBeMimicked; /* Xeroc disguise or hallucination char? */ }; struct _screenchars scrObjects[OBJECTTYPES] = { ! { ARMOR, ']', '\x08', BRIGHT_BLUE, BLACK, 1 }, ! { WEAPON, ')', '\x18', BRIGHT_BLUE, BLACK, 1 }, ! { SCROL, '?', '\x0D', BRIGHT_BLUE, BLACK, 1 }, ! { POTION, '!', '\xAD', BRIGHT_BLUE, BLACK, 1 }, ! { GOLD, '*', '\x0F', BRIGHT_YELLOW, BLACK, 1 }, ! { FOOD, ':', '\x05', RED, BLACK, 1 }, ! { WAND, '/', '\xE7', BRIGHT_BLUE, BLACK, 1 }, ! { RING, '=', '\x09', BRIGHT_BLUE, BLACK, 1 }, ! { AMULET, ',', '\x0C', BRIGHT_BLUE, BLACK, 0 } }; struct _screenchars scrTerrain[TERRAINTYPES] = { ! { NOTHING, ' ', ' ', WHITE, BLACK, 0 }, ! { OBJECT, '~', '~', WHITE, BLACK, 0 }, /* error */ ! { MONSTER, 'm', 'm', WHITE, BLACK, 0 }, /* error */ ! { STAIRS, '%', '\xF0', BLACK, BRIGHT_GREEN, 1 }, ! { HORWALL, '-', '\xCD', YELLOW, BLACK, 0 }, ! { VERTWALL,'|', '\xBA', YELLOW, BLACK, 0 }, ! { ULCORNER,'-', '\xC9', YELLOW, BLACK, 0 }, ! { URCORNER,'-', '\xBB', YELLOW, BLACK, 0 }, ! { LLCORNER,'-', '\xC8', YELLOW, BLACK, 0 }, ! { LRCORNER,'-', '\xBC', YELLOW, BLACK, 0 }, ! { DOOR, '+', '\xCE', YELLOW, BLACK, 0 }, ! { FLOOR, '.', '\xFA', BRIGHT_GREEN, BLACK, 0 }, ! { TUNNEL, '#', '\xB1', WHITE, BLACK, 0 }, ! { TRAP, '^', '\x04', MAGENTA, BLACK, 0 } }; --- 110,146 ---- struct _screenchars { unsigned short mask; /* as defined in rogue.h */ ! chtype ch; /* classic screen character */ ! chtype dosch; /* DOS screen character */ ! attr_t color; /* color */ boolean canBeMimicked; /* Xeroc disguise or hallucination char? */ }; struct _screenchars scrObjects[OBJECTTYPES] = { ! { ARMOR, ']', 0x08|A_ALTCHARSET, COLOR_PAIR(COLOR_BLUE)|A_BOLD, 1 }, ! { WEAPON, ')', 0x18|A_ALTCHARSET, COLOR_PAIR(COLOR_BLUE)|A_BOLD, 1 }, ! { SCROL, '?', 0x0D|A_ALTCHARSET, COLOR_PAIR(COLOR_BLUE)|A_BOLD, 1 }, ! { POTION, '!', 0xAD|A_ALTCHARSET, COLOR_PAIR(COLOR_BLUE)|A_BOLD, 1 }, ! { GOLD, '*', 0x0F|A_ALTCHARSET, COLOR_PAIR(COLOR_YELLOW)|A_BOLD, 1 }, ! { FOOD, ':', 0x05|A_ALTCHARSET, COLOR_PAIR(COLOR_RED), 1 }, ! { WAND, '/', 0xE7|A_ALTCHARSET, COLOR_PAIR(COLOR_BLUE)|A_BOLD, 1 }, ! { RING, '=', 0x09|A_ALTCHARSET, COLOR_PAIR(COLOR_BLUE)|A_BOLD, 1 }, ! { AMULET, ',', 0x0C|A_ALTCHARSET, COLOR_PAIR(COLOR_BLUE)|A_BOLD, 0 } }; struct _screenchars scrTerrain[TERRAINTYPES] = { ! { NOTHING, ' ', ' ', COLOR_PAIR(COLOR_WHITE), 0 }, ! { OBJECT, '~', '~', COLOR_PAIR(COLOR_WHITE), 0 }, /* error */ ! { MONSTER, 'm', 'm', COLOR_PAIR(COLOR_WHITE), 0 }, /* error */ ! { STAIRS, '%', 0xF0|A_ALTCHARSET, COLOR_PAIR(COLOR_STAIRS)|A_BLINK, 1 }, ! { HORWALL, '-', 0xCD|A_ALTCHARSET, COLOR_PAIR(COLOR_YELLOW), 0 }, ! { VERTWALL,'|', 0xBA|A_ALTCHARSET, COLOR_PAIR(COLOR_YELLOW), 0 }, ! { ULCORNER,'-', 0xC9|A_ALTCHARSET, COLOR_PAIR(COLOR_YELLOW), 0 }, ! { URCORNER,'-', 0xBB|A_ALTCHARSET, COLOR_PAIR(COLOR_YELLOW), 0 }, ! { LLCORNER,'-', 0xC8|A_ALTCHARSET, COLOR_PAIR(COLOR_YELLOW), 0 }, ! { LRCORNER,'-', 0xBC|A_ALTCHARSET, COLOR_PAIR(COLOR_YELLOW), 0 }, ! { DOOR, '+', 0xCE|A_ALTCHARSET, COLOR_PAIR(COLOR_YELLOW), 0 }, ! { FLOOR, '.', 0xFA|A_ALTCHARSET, COLOR_PAIR(COLOR_GREEN)|A_BOLD, 0 }, ! { TUNNEL, '#', 0xB1|A_ALTCHARSET, COLOR_PAIR(COLOR_WHITE), 0 }, ! { TRAP, '^', 0x04|A_ALTCHARSET, COLOR_PAIR(COLOR_MAGENTA), 0 } }; *************** *** 181,188 **** } } ! mvaddcch(i, j, get_dungeon_char(i, j)); } } ! mvaddcch(rogue.row, rogue.col, get_rogue_char()); /* NS - added this so that hallucinating characters don't see the --- 180,187 ---- } } ! mvaddch(i, j, get_dungeon_char(i, j)); } } ! mvaddch(rogue.row, rogue.col, get_rogue_char()); /* NS - added this so that hallucinating characters don't see the *************** *** 209,213 **** for (j = ((col > 0) ? -1 : 0); j <= j_end; j++) { if (can_move(row, col, (short) (row+i), (short) (col+j))) { ! mvaddcch((short) (row+i), (short) (col+j), get_dungeon_char((short) (row+i), (short) (col+j))); } --- 208,212 ---- for (j = ((col > 0) ? -1 : 0); j <= j_end; j++) { if (can_move(row, col, (short) (row+i), (short) (col+j))) { ! mvaddch((short) (row+i), (short) (col+j), get_dungeon_char((short) (row+i), (short) (col+j))); } *************** *** 232,236 **** } if ((dungeon[i][j] & TRAP) && (!(dungeon[i][j] & HIDDEN))) { ! mvaddcch(i, j, get_terrain_char(TRAP)); } } --- 231,235 ---- } if ((dungeon[i][j] & TRAP) && (!(dungeon[i][j] & HIDDEN))) { ! mvaddch(i, j, get_terrain_char(TRAP)); } } *************** *** 241,247 **** ! color_char get_terrain_char(const unsigned short mask) { ! color_char cc; int i; --- 240,246 ---- ! chtype get_terrain_char(const unsigned short mask) { ! chtype cc; int i; *************** *** 249,257 **** for (i=0; i<TERRAINTYPES; i++) { if (scrTerrain[i].mask == mask) { ! cc.b8.color = use_color ? ! MAKE_COLOR(scrTerrain[i].fgcolor, scrTerrain[i].bgcolor) : ! MAKE_COLOR(WHITE, BLACK); ! cc.b8.ch = use_doschars ? scrTerrain[i].dosch : scrTerrain[i].ch; ! return cc; } --- 248,253 ---- for (i=0; i<TERRAINTYPES; i++) { if (scrTerrain[i].mask == mask) { ! cc = use_doschars ? scrTerrain[i].dosch : scrTerrain[i].ch; ! cc |= use_color ? scrTerrain[i].color : COLOR_PAIR(COLOR_WHITE); return cc; } *************** *** 259,264 **** /* error! */ ! cc.b8.color = MAKE_COLOR(BRIGHT_WHITE, BLACK); ! cc.b8.ch = '~'; return cc; } --- 255,259 ---- /* error! */ ! cc = COLOR_PAIR(COLOR_WHITE)|A_BOLD | '~'; return cc; } *************** *** 266,273 **** ! color_char get_dungeon_char(const short row, const short col) { unsigned short mask = dungeon[row][col]; ! color_char cc; /* monsters are at the top layer and overlay all else */ --- 261,268 ---- ! chtype get_dungeon_char(const short row, const short col) { unsigned short mask = dungeon[row][col]; ! chtype cc; /* monsters are at the top layer and overlay all else */ *************** *** 281,288 **** obj = object_at(&level_objects, row, col); ! cc.b16 = get_mask_char(obj->what_is).b16; ! if ((mask & TUNNEL) && use_doschars) cc.b8.color = MAKE_COLOR(FGCOLOR_OF(cc.b8.color), ! use_color ? WHITE : GRAY); return cc; } --- 276,285 ---- obj = object_at(&level_objects, row, col); ! cc = get_mask_char(obj->what_is); ! ! /* make this work with curses */ ! /* if ((mask & TUNNEL) && use_doschars) cc.b8.color = MAKE_COLOR(FGCOLOR_OF(cc.b8.color), ! use_color ? WHITE : GRAY); */ return cc; } *************** *** 344,354 **** ! /* Returns the screen character of the specified item. ! * NS: This now returns a 16-bit color_char. ! */ ! color_char get_mask_char(const unsigned short mask) { ! color_char cc; int i; --- 341,349 ---- ! /* Returns the screen character of the specified item. */ ! chtype get_mask_char(const unsigned short mask) { ! chtype cc; int i; *************** *** 356,363 **** for (i=0; i<OBJECTTYPES; i++) { if (scrObjects[i].mask == mask) { ! cc.b8.color = use_color ? ! MAKE_COLOR(scrObjects[i].fgcolor, scrObjects[i].bgcolor) : ! MAKE_COLOR(WHITE, BLACK); ! cc.b8.ch = use_doschars ? scrObjects[i].dosch : scrObjects[i].ch; return cc; } --- 351,356 ---- for (i=0; i<OBJECTTYPES; i++) { if (scrObjects[i].mask == mask) { ! cc = use_doschars ? scrObjects[i].dosch : scrObjects[i].ch; ! cc |= use_color ? scrObjects[i].color : COLOR_PAIR(COLOR_WHITE); return cc; } *************** *** 365,370 **** /* error! */ ! cc.b8.color = MAKE_COLOR(BRIGHT_WHITE, BLACK); ! cc.b8.ch = '~'; return cc; } --- 358,362 ---- /* error! */ ! cc = COLOR_PAIR(COLOR_WHITE)|A_BOLD | '~'; return cc; } *************** *** 374,383 **** */ ! color_char get_rogue_char(void) { ! color_char cc; ! cc.b8.color = (use_color) ? rogue.color : MAKE_COLOR(WHITE,BLACK); ! cc.b8.ch = (use_doschars) ? rogue.dosfchar : rogue.fchar; return cc; } --- 366,375 ---- */ ! chtype get_rogue_char(void) { ! chtype cc; ! cc = (use_doschars) ? rogue.dosfchar : rogue.fchar; ! cc |= (use_color) ? rogue.color : COLOR_PAIR(COLOR_WHITE); return cc; } *************** *** 411,419 **** /* draw the character */ ! addcch(get_dungeon_char(i, j)); } } } ! mvaddcch(rogue.row, rogue.col, get_rogue_char()); print_stats(STAT_ALL); } --- 403,411 ---- /* draw the character */ ! addch(get_dungeon_char(i, j)); } } } ! mvaddch(rogue.row, rogue.col, get_rogue_char()); print_stats(STAT_ALL); } *************** *** 544,548 **** { short i, j, ch; ! color_char cch, occh; unsigned short mask = (ANYROOMSIDE | DOOR | TUNNEL | TRAP | STAIRS | MONSTER); --- 536,540 ---- { short i, j, ch; ! chtype cch, occh; unsigned short mask = (ANYROOMSIDE | DOOR | TUNNEL | TRAP | STAIRS | MONSTER); *************** *** 554,562 **** if (s & mask) { ch = (short) mvinch(i,j); ! cch.b16 = mvincch(i,j).b16; if ((ch == ' ') || ((ch >= 'A') && (ch <= 'Z')) || (s & (TRAP | HIDDEN))) { ! occh.b16 = cch.b16; dungeon[i][j] &= (~HIDDEN); if (s & HORWALL) { --- 546,554 ---- if (s & mask) { ch = (short) mvinch(i,j); ! cch = mvinch(i,j); if ((ch == ' ') || ((ch >= 'A') && (ch <= 'Z')) || (s & (TRAP | HIDDEN))) { ! occh = cch; dungeon[i][j] &= (~HIDDEN); if (s & HORWALL) { *************** *** 584,588 **** } if ((!(s & MONSTER)) || (ch == ' ')) { ! addcch(cch); } if (s & MONSTER) { --- 576,580 ---- } if ((!(s & MONSTER)) || (ch == ' ')) { ! addch(cch); } if (s & MONSTER) { *************** *** 590,594 **** if (monster = object_at(&level_monsters, i, j)) { ! monster->trail_char.b16 = cch.b16; } } --- 582,586 ---- if (monster = object_at(&level_monsters, i, j)) { ! monster->trail_char = cch; } } *************** *** 597,601 **** } } ! mvaddcch(rogue.row, rogue.col, get_rogue_char()); } --- 589,593 ---- } } ! mvaddch(rogue.row, rogue.col, get_rogue_char()); } *************** *** 703,707 **** void edit_opts(void) { ! color_char save[NOPTS+1][DCOLS]; short i, j; short ch; --- 695,699 ---- void edit_opts(void) { ! chtype save[NOPTS+1][DCOLS]; short i, j; short ch; *************** *** 714,718 **** for (i = 0; i < NOPTS+1; i++) { for (j = 0; j < DCOLS; j++) { ! save[i][j] = mvincch(i, j); } if (i < NOPTS) { --- 706,710 ---- for (i = 0; i < NOPTS+1; i++) { for (j = 0; j < DCOLS; j++) { ! save[i][j] = mvinch(i, j); } if (i < NOPTS) { *************** *** 801,805 **** move(i, 0); for (j = 0; j < DCOLS; j++) { ! addcch(save[i][j]); } if (options[i].is_bool && options[i].redraw_necc --- 793,797 ---- move(i, 0); for (j = 0; j < DCOLS; j++) { ! addch(save[i][j]); } if (options[i].is_bool && options[i].redraw_necc *************** *** 837,843 **** struct option *opt = &options[i]; ! mvaddstr_in_color(i, 0, opt->prompt, ! (unsigned char) (use_color ? MAKE_COLOR(CYAN, BLACK) : ! MAKE_COLOR(WHITE,BLACK))); clrtoeol(); } --- 829,836 ---- struct option *opt = &options[i]; ! attron(use_color ? COLOR_PAIR(COLOR_CYAN) : COLOR_PAIR(COLOR_WHITE)); ! mvaddstr(i, 0, opt->prompt); ! attroff(use_color ? COLOR_PAIR(COLOR_CYAN) : COLOR_PAIR(COLOR_WHITE)); ! clrtoeol(); } *************** *** 860,868 **** move( (short) (LINES-1), 0); refresh(); stop_window(); printf("\n\nSpawning new shell. Type 'exit' to return to rogue...\n"); md_shell(sh); start_window(); ! redraw(); md_heed_signals(); } --- 853,862 ---- move( (short) (LINES-1), 0); refresh(); + def_prog_mode(); stop_window(); printf("\n\nSpawning new shell. Type 'exit' to return to rogue...\n"); md_shell(sh); start_window(); ! wrefresh(curscr); md_heed_signals(); } *************** *** 877,884 **** */ ! color_char gr_obj_char(const int ix) { struct _screenchars *sc; ! color_char cc; /* initialize groc array and check for failing case */ --- 871,878 ---- */ ! chtype gr_obj_char(const int ix) { struct _screenchars *sc; ! chtype cc; /* initialize groc array and check for failing case */ *************** *** 887,892 **** } if (dc_len <= 0) { /* ugh */ ! cc.b8.color = MAKE_COLOR(WHITE, BLACK); ! cc.b8.ch = '~'; return cc; } --- 881,885 ---- } if (dc_len <= 0) { /* ugh */ ! cc = COLOR_PAIR(COLOR_WHITE) | '~'; return cc; } *************** *** 900,906 **** /* construct the color character */ ! cc.b8.ch = (use_doschars) ? sc->dosch : sc->ch; ! cc.b8.color = (use_color) ? MAKE_COLOR(sc->fgcolor, sc->bgcolor) : ! MAKE_COLOR(WHITE, BLACK); return cc; } --- 893,898 ---- /* construct the color character */ ! cc = (use_doschars) ? sc->dosch : sc->ch; ! cc |= (use_color) ? sc->color : COLOR_PAIR(COLOR_WHITE); return cc; } Index: hit.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/hit.c,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** hit.c 16 Jun 2008 04:42:04 -0000 1.6 --- hit.c 18 Jun 2008 03:16:13 -0000 1.6.2.1 *************** *** 292,296 **** col = monster->col; dungeon[row][col] &= ~MONSTER; ! mvaddcch(row, col, get_dungeon_char(row, col)); fight_monster = 0; --- 292,296 ---- col = monster->col; dungeon[row][col] &= ~MONSTER; ! mvaddch(row, col, get_dungeon_char(row, col)); fight_monster = 0; Index: spec_hit.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/spec_hit.c,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** spec_hit.c 13 Jun 2008 00:19:06 -0000 1.6 --- spec_hit.c 18 Jun 2008 03:16:13 -0000 1.6.2.1 *************** *** 236,240 **** dungeon[row][col] &= ~MONSTER; if (rogue_can_see(row, col)) { ! mvaddcch(row, col, get_dungeon_char(row, col)); } take_from_pack(monster, &level_monsters); --- 236,240 ---- dungeon[row][col] &= ~MONSTER; if (rogue_can_see(row, col)) { ! mvaddch(row, col, get_dungeon_char(row, col)); } take_from_pack(monster, &level_monsters); *************** *** 293,297 **** static int try_to_cough(const short row, const short col, object *obj) /*only used within this file*/ { ! color_char cc; object *monster; --- 293,297 ---- static int try_to_cough(const short row, const short col, object *obj) /*only used within this file*/ { ! chtype cc; object *monster; *************** *** 305,313 **** if ((row != rogue.row) || (col != rogue.col)) { if (!(dungeon[row][col] & MONSTER)) { ! mvaddcch(row, col, cc); } else { monster = object_at(&level_monsters, row, col); if (monster != 0) ! monster->trail_char.b16 = cc.b16; } } --- 305,313 ---- if ((row != rogue.row) || (col != rogue.col)) { if (!(dungeon[row][col] & MONSTER)) { ! mvaddch(row, col, cc); } else { monster = object_at(&level_monsters, row, col); if (monster != 0) ! monster->trail_char = cc; } } *************** *** 377,381 **** wake_up(monster); if (!blind) { ! mvaddcch(monster->row, monster->col, get_dungeon_char(monster->row, monster->col)); check_message(); --- 377,381 ---- wake_up(monster); if (!blind) { ! mvaddch(monster->row, monster->col, get_dungeon_char(monster->row, monster->col)); check_message(); Index: machdep.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/machdep.c,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** machdep.c 16 Jun 2008 04:42:04 -0000 1.7 --- machdep.c 18 Jun 2008 03:16:13 -0000 1.7.2.1 *************** *** 93,96 **** --- 93,97 ---- #ifdef _MSC_VER #define WIN32_LEAN_AND_MEAN + #undef MOUSE_MOVED /* kludge for pdcurses */ #include <windows.h> #endif Index: message.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/message.c,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** message.c 14 Jun 2008 02:38:02 -0000 1.7 --- message.c 18 Jun 2008 03:16:13 -0000 1.7.2.1 *************** *** 56,60 **** extern boolean cant_int, did_int, interrupted, save_is_interactive; ! extern boolean use_doschars, use_color, beep; extern short add_strength; extern short cur_level; --- 56,60 ---- extern boolean cant_int, did_int, interrupted, save_is_interactive; ! extern boolean use_doschars, use_color, use_bell; extern short add_strength; extern short cur_level; *************** *** 206,237 **** boolean label; short row = DROWS - 1; ! byte color; label = (stat_mask & STAT_LABEL) ? 1 : 0; ! color = use_color ? BRIGHT_YELLOW : MAKE_COLOR(WHITE,BLACK); if (stat_mask & STAT_LEVEL) { if (label) { ! mvaddstr_in_color(row, 0, "Level: ", color); } /* max level taken care of in make_level() */ sprintf(buf, "%d", cur_level); ! mvaddstr_in_color(row, 7, buf, color); pad(buf, 2); } if (stat_mask & STAT_GOLD) { if (label) { ! mvaddstr_in_color(row, 10, "Gold: ", color); } if (rogue.gold > MAX_GOLD) { rogue.gold = MAX_GOLD; } ! sprintf(buf, "%ld", rogue.gold); ! mvaddstr_in_color(row, 16, buf, color); pad(buf, 6); } if (stat_mask & STAT_HP) { if (label) { ! mvaddstr_in_color(row, 23, "Hp: ", color); } if (rogue.hp_max > MAX_HP) { --- 206,247 ---- boolean label; short row = DROWS - 1; ! attr_t color; label = (stat_mask & STAT_LABEL) ? 1 : 0; ! color = use_color ? COLOR_PAIR(COLOR_YELLOW)|A_BOLD : COLOR_PAIR(COLOR_WHITE); if (stat_mask & STAT_LEVEL) { if (label) { ! attron(color); ! mvaddstr(row, 0, "Level: "); ! attroff(color); } /* max level taken care of in make_level() */ sprintf(buf, "%d", cur_level); ! attron(color); ! mvaddstr(row, 7, buf); ! attroff(color); pad(buf, 2); } if (stat_mask & STAT_GOLD) { if (label) { ! attron(color); ! mvaddstr(row, 10, "Gold: "); ! attroff(color); } if (rogue.gold > MAX_GOLD) { rogue.gold = MAX_GOLD; } ! sprintf(buf, "%ld", rogue.gold); ! attron(color); ! mvaddstr(row, 16, buf); ! attroff(color); pad(buf, 6); } if (stat_mask & STAT_HP) { if (label) { ! attron(color); ! mvaddstr(row, 23, "Hp: "); ! attroff(color); } if (rogue.hp_max > MAX_HP) { *************** *** 240,249 **** } sprintf(buf, "%d(%d)", rogue.hp_current, rogue.hp_max); ! mvaddstr_in_color(row, 27, buf, color); pad(buf, 8); } if (stat_mask & STAT_STRENGTH) { if (label) { ! mvaddstr_in_color(row, 36, "Str: ", color); } if (rogue.str_max > MAX_STRENGTH) { --- 250,263 ---- } sprintf(buf, "%d(%d)", rogue.hp_current, rogue.hp_max); ! attron(color); ! mvaddstr(row, 27, buf); ! attroff(color); pad(buf, 8); } if (stat_mask & STAT_STRENGTH) { if (label) { ! attron(color); ! mvaddstr(row, 36, "Str: "); ! attroff(color); } if (rogue.str_max > MAX_STRENGTH) { *************** *** 253,262 **** sprintf(buf, "%d(%d)", (rogue.str_current + add_strength), rogue.str_max); ! mvaddstr_in_color(row, 41, buf, color); pad(buf, 6); } if (stat_mask & STAT_ARMOR) { if (label) { ! mvaddstr_in_color(row, 48, "Arm: ", color); } if (rogue.armor && (rogue.armor->d_enchant > MAX_ARMOR)) { --- 267,280 ---- sprintf(buf, "%d(%d)", (rogue.str_current + add_strength), rogue.str_max); ! attron(color); ! mvaddstr(row, 41, buf); ! attroff(color); pad(buf, 6); } if (stat_mask & STAT_ARMOR) { if (label) { ! attron(color); ! mvaddstr(row, 48, "Arm: "); ! attroff(color); } if (rogue.armor && (rogue.armor->d_enchant > MAX_ARMOR)) { *************** *** 264,273 **** } sprintf(buf, "%d", get_armor_class(rogue.armor)); ! mvaddstr_in_color(row, 53, buf, color); pad(buf, 2); } if (stat_mask & STAT_EXP) { if (label) { ! mvaddstr_in_color(row, 56, "Exp: ", color); } if (rogue.exp_points > MAX_EXP) { --- 282,295 ---- } sprintf(buf, "%d", get_armor_class(rogue.armor)); ! attron(color); ! mvaddstr(row, 53, buf); ! attroff(color); pad(buf, 2); } if (stat_mask & STAT_EXP) { if (label) { ! attron(color); ! mvaddstr(row, 56, "Exp: "); ! attroff(color); } if (rogue.exp_points > MAX_EXP) { *************** *** 278,287 **** } sprintf(buf, "%d/%ld", rogue.exp, rogue.exp_points); ! mvaddstr_in_color(row, 61, buf, color); pad(buf, 11); } if (stat_mask & STAT_HUNGER) { ! mvaddstr_in_color(row, 73, hunger_str, color); ! clrtoeol(); } refresh(); --- 300,313 ---- } sprintf(buf, "%d/%ld", rogue.exp, rogue.exp_points); ! attron(color); ! mvaddstr(row, 61, buf); ! attroff(color); pad(buf, 11); } if (stat_mask & STAT_HUNGER) { ! attron(color); ! mvaddstr(row, 73, hunger_str); ! attroff(color); ! clrtoeol(); } refresh(); *************** *** 342,346 **** void sound_bell(void) { ! if(beep) { putchar(7); } --- 368,372 ---- void sound_bell(void) { ! if(use_bell) { putchar(7); } Index: monster.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/monster.c,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** monster.c 16 Jun 2008 04:42:04 -0000 1.6 --- monster.c 18 Jun 2008 03:16:13 -0000 1.6.2.1 *************** *** 281,288 **** * except for imitators. */ ! color_char gmc_row_col(const short row, const short col) { object *monster; ! color_char cc; if (monster = object_at(&level_monsters, row, col)) { --- 281,288 ---- * except for imitators. */ ! chtype gmc_row_col(const short row, const short col) { object *monster; ! chtype cc; if (monster = object_at(&level_monsters, row, col)) { *************** *** 290,295 **** } else { /* BUG if this ever happens */ ! cc.b8.color = MAKE_COLOR(WHITE,BLACK); ! cc.b8.ch = '&'; return (cc); } --- 290,294 ---- } else { /* BUG if this ever happens */ ! cc = COLOR_PAIR(COLOR_WHITE) | '&'; return (cc); } *************** *** 297,303 **** ! color_char gmc(const object *monster) { ! color_char cc; /* invisible/blinded */ --- 296,302 ---- ! chtype gmc(const object *monster) { ! chtype cc; /* invisible/blinded */ *************** *** 309,319 **** /* imitator */ if (monster->m_flags & IMITATES) { ! cc.b16 = gr_obj_char(monster->disguise).b16; return(cc); } /* your garden variety monster */ ! cc.b8.color = MAKE_COLOR(WHITE,BLACK); ! cc.b8.ch = (char) monster->m_char; return(cc); } --- 308,317 ---- /* imitator */ if (monster->m_flags & IMITATES) { ! cc = gr_obj_char(monster->disguise); return(cc); } /* your garden variety monster */ ! cc = COLOR_PAIR(COLOR_WHITE) | monster->m_char; return(cc); } *************** *** 483,503 **** if ((c >= 'A') && (c <= 'Z')) { if (!detect_monster) { ! mvaddcch(mrow, mcol, monster->trail_char); } else { if (rogue_can_see(mrow, mcol)) { ! mvaddcch(mrow, mcol, monster->trail_char); } else { ! if (monster->trail_char.b16 == get_terrain_char(FLOOR).b16) { monster->trail_char = get_terrain_char(NOTHING); } ! mvaddcch(mrow, mcol, monster->trail_char); } } } ! monster->trail_char.b16 = mvincch(row, col).b16; if (!blind && (detect_monster || rogue_can_see(row, col))) { if ((!(monster->m_flags & INVISIBLE) || (detect_monster || see_invisible || r_see_invisible))) { ! mvaddcch(row, col, gmc(monster)); } } --- 481,501 ---- if ((c >= 'A') && (c <= 'Z')) { if (!detect_monster) { ! mvaddch(mrow, mcol, monster->trail_char); } else { if (rogue_can_see(mrow, mcol)) { ! mvaddch(mrow, mcol, monster->trail_char); } else { ! if (monster->trail_char == get_terrain_char(FLOOR)) { monster->trail_char = get_terrain_char(NOTHING); } ! mvaddch(mrow, mcol, monster->trail_char); } } } ! monster->trail_char = mvinch(row, col); if (!blind && (detect_monster || rogue_can_see(row, col))) { if ((!(monster->m_flags & INVISIBLE) || (detect_monster || see_invisible || r_see_invisible))) { ! mvaddch(row, col, gmc(monster)); } } *************** *** 672,676 **** while (monster) { ! mvaddcch(monster->row, monster->col, gmc(monster)); if (monster->m_flags & IMITATES) { monster->m_flags &= (~IMITATES); --- 670,674 ---- while (monster) { ! mvaddch(monster->row, monster->col, gmc(monster)); if (monster->m_flags & IMITATES) { monster->m_flags &= (~IMITATES); *************** *** 708,712 **** monster = gr_monster((object *) 0, 0); put_m_at(row, col, monster); ! mvaddcch(row, col, gmc(monster)); if (monster->m_flags & (WANDERS | WAKENS)) { wake_up(monster); --- 706,710 ---- monster = gr_monster((object *) 0, 0); put_m_at(row, col, monster); ! mvaddch(row, col, gmc(monster)); if (monster->m_flags & (WANDERS | WAKENS)) { wake_up(monster); *************** *** 723,727 **** monster->col = col; dungeon[row][col] |= MONSTER; ! monster->trail_char.b16 = mvincch(row, col).b16; (void) add_to_pack(monster, &level_monsters, 0); aim_monster(monster); --- 721,725 ---- monster->col = col; dungeon[row][col] |= MONSTER; ! monster->trail_char = mvinch(row, col); (void) add_to_pack(monster, &level_monsters, 0); aim_monster(monster); *************** *** 842,846 **** monster->m_flags &= (~IMITATES); if (rogue_can_see(monster->row, monster->col)) { ! mvaddcch(monster->row, monster->col, gmc(monster)); } monster = monster->next_monster; --- 840,844 ---- monster->m_flags &= (~IMITATES); if (rogue_can_see(monster->row, monster->col)) { ! mvaddch(monster->row, monster->col, gmc(monster)); } monster = monster->next_monster; Index: level.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/level.c,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** level.c 13 Jun 2008 00:19:06 -0000 1.5 --- level.c 18 Jun 2008 03:16:13 -0000 1.5.2.1 *************** *** 775,779 **** new_level_message = 0; } ! mvaddcch(rogue.row, rogue.col, get_rogue_char()); } --- 775,779 ---- new_level_message = 0; } ! mvaddch(rogue.row, rogue.col, get_rogue_char()); } Index: rogue.h =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/rogue.h,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** rogue.h 16 Jun 2008 04:42:04 -0000 1.9 --- rogue.h 18 Jun 2008 03:16:13 -0000 1.9.2.1 *************** *** 226,231 **** --- 226,245 ---- }; + #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 */ + typedef chtype attr_t; + chtype mvinch(short row, short col); + #if 0 /* Support for color GUI... */ *************** *** 254,258 **** unsigned short b16; }; ! typedef union _colorChar color_char; #define MAKE_COLOR(fg,bg) (byte)(((fg) & 0x0F) | (((bg) & 0x0F) << 4)) --- 268,272 ---- unsigned short b16; }; ! /* typedef union _colorChar color_char; */ #define MAKE_COLOR(fg,bg) (byte)(((fg) & 0x0F) | (((bg) & 0x0F) << 4)) *************** *** 264,268 **** --- 278,284 ---- #define BGCOLOR_OF(col) (byte)(((col) >> 4) & 0x0F) #define FGCOLOR_OF(col) (byte)((col) & 0x0F) + #endif + #endif /* !HAVECURSES */ *************** *** 308,312 **** short picked_up; /* sleep from wand of sleep */ unsigned short in_use_flags; ! color_char cchar; /* character underneath monster */ int dchar_ix; /* imitator's character index */ struct obj *next_object; /* next monster */ --- 324,328 ---- short picked_up; /* sleep from wand of sleep */ unsigned short in_use_flags; ! chtype cchar; /* character underneath monster */ int dchar_ix; /* imitator's character index */ struct obj *next_object; /* next monster */ *************** *** 324,330 **** #define INIT_PACK {0} #define INIT_GOLD 0 ! #define INIT_CHAR_COLOR MAKE_COLOR(BRIGHT_YELLOW, BLACK) #define INIT_CHAR '@' ! #define INIT_DOSCHAR '\x1' #define INIT_MOVES 1250 --- 340,346 ---- #define INIT_PACK {0} #define INIT_GOLD 0 ! #define INIT_CHAR_COLOR COLOR_PAIR(COLOR_YELLOW)|A_BOLD #define INIT_CHAR '@' ! #define INIT_DOSCHAR 0x01|A_ALTCHARSET #define INIT_MOVES 1250 *************** *** 342,348 **** long exp_points; short row, col; ! byte color; ! char fchar; ! char dosfchar; short moves_left; }; --- 358,364 ---- long exp_points; short row, col; ! attr_t color; ! chtype fchar; ! chtype dosfchar; short moves_left; }; *************** *** 575,583 **** typedef struct rogue_time_struct_definition rogue_time; /* fixes many compiler wanings */ - extern int LINES, COLS; - /* curses.c */ char rgetchar(void); void initscr(void); void move(const short row, const short col); --- 591,598 ---- typedef struct rogue_time_struct_definition rogue_time; /* fixes many compiler wanings */ /* curses.c */ char rgetchar(void); + #ifndef HAVECURSES void initscr(void); void move(const short row, const short col); *************** *** 585,608 **** void mvaddstr(const short row, const short col, char *str); void mvaddstr_in_color(const short row, const short col, char *str, const byte color); ! void mvaddcstr(const short row, const short col, color_char *cstr); void addch(const int ch); void mvaddch(const short row, const short col, const int ch); ! void addcch(const color_char cc); ! void mvaddcch(const short row, const short col, const color_char cc); ! void colorize(char *str, const byte color, color_char *cstr); void refresh(void); void redraw(void); int mvinch(const short row, const short col); ! color_char mvincch(const short row, const short col); void clear(void); void clrtoeol(void); void standout(void); void standend(void); ! void draw_box(const color_char cset[6], const short ulrow, const short ulcol, const short height, const short width); void endwin(void); void crmode(void); void noecho(void); void nonl(void); ! /* hit.c */ --- 600,623 ---- void mvaddstr(const short row, const short col, char *str); void mvaddstr_in_color(const short row, const short col, char *str, const byte color); ! void mvaddcstr(const short row, const short col, chtype *cstr); void addch(const int ch); void mvaddch(const short row, const short col, const int ch); ! void addcch(const chtype cc); ! void mvaddcch(const short row, const short col, const chtype cc); ! void colorize(char *str, const byte color, chtype *cstr); 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); void clrtoeol(void); void standout(void); void standend(void); ! void draw_box(const chtype cset[6], const short ulrow, const short ulcol, const short height, const short width); void endwin(void); void crmode(void); void noecho(void); void nonl(void); ! #endif /* hit.c */ *************** *** 703,708 **** void mv_mons(void); void party_monsters(const int rn, int n); ! color_char gmc_row_col(const short row, const short col); ! color_char gmc(const object *monster); void mv_1_monster(object *monster, short row, short col); void move_mon_to(object *monster, const short row, const short col); --- 718,723 ---- void mv_mons(void); void party_monsters(const int rn, int n); ! chtype gmc_row_col(const short row, const short col); ! chtype gmc(const object *monster); void mv_1_monster(object *monster, short row, short col); void move_mon_to(object *monster, const short row, const short col); *************** *** 810,817 **** void light_passage(const short row, const short col); void darken_room(const short rn); ! color_char get_terrain_char(const unsigned short mask); ! color_char get_dungeon_char(const short row, const short col); ! color_char get_mask_char(const unsigned short mask); ! color_char get_rogue_char(void); void regenerate_screen(void); void gr_row_col(short *row, short *col, const unsigned short mask); --- 825,832 ---- void light_passage(const short row, const short col); void darken_room(const short rn); ! chtype get_terrain_char(const unsigned short mask); ! chtype get_dungeon_char(const short row, const short col); ! chtype get_mask_char(const unsigned short mask); ! chtype get_rogue_char(void); void regenerate_screen(void); void gr_row_col(short *row, short *col, const unsigned short mask); *************** *** 824,828 **** void edit_opts(void); void do_shell(void); ! color_char gr_obj_char(const int ix); int gr_obj_index(void); --- 839,843 ---- void edit_opts(void); void do_shell(void); ! chtype gr_obj_char(const int ix); int gr_obj_index(void); Index: move.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/move.c,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** move.c 15 Jun 2008 19:22:46 -0000 1.7 --- move.c 18 Jun 2008 03:16:13 -0000 1.7.2.1 *************** *** 123,128 **** light_passage(row, col); } ! mvaddcch(rogue.row, rogue.col, get_dungeon_char(rogue.row, rogue.col)); ! mvaddcch(row, col, get_rogue_char()); if (!jump) { --- 123,128 ---- light_passage(row, col); } ! mvaddch(rogue.row, rogue.col, get_dungeon_char(rogue.row, rogue.col)); ! mvaddch(row, col, get_rogue_char()); if (!jump) { Index: zap.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/zap.c,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** zap.c 13 Jun 2008 00:19:06 -0000 1.7 --- zap.c 18 Jun 2008 03:16:14 -0000 1.7.2.1 *************** *** 139,143 **** short row, col; object *nm; ! color_char tc; row = monster->row; --- 139,143 ---- short row, col; object *nm; ! chtype tc; row = monster->row; *************** *** 171,180 **** } nm = monster->next_monster; ! tc.b16 = monster->trail_char.b16; (void) gr_monster(monster, get_rand(0, MONSTERS-1)); monster->row = row; monster->col = col; monster->next_monster = nm; ! monster->trail_char.b16 = tc.b16; if (!(monster->m_flags & IMITATES)) { wake_up(monster); --- 171,180 ---- } nm = monster->next_monster; ! tc = monster->trail_char; (void) gr_monster(monster, get_rand(0, MONSTERS-1)); monster->row = row; monster->col = col; monster->next_monster = nm; ! monster->trail_char = tc; if (!(monster->m_flags & IMITATES)) { wake_up(monster); *************** *** 209,219 **** } gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT)); ! mvaddcch(monster->row, monster->col, monster->trail_char); dungeon[monster->row][monster->col] &= ~MONSTER; monster->row = row; monster->col = col; dungeon[row][col] |= MONSTER; ! monster->trail_char.b16 = mvincch(row, col).b16; if (detect_monster || rogue_can_see(row, col)) { ! mvaddcch(row, col, gmc(monster)); } } --- 209,219 ---- } gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT)); ! mvaddch(monster->row, monster->col, monster->trail_char); dungeon[monster->row][monster->col] &= ~MONSTER; monster->row = row; monster->col = col; dungeon[row][col] |= MONSTER; ! monster->trail_char = mvinch(row, col); if (detect_monster || rogue_can_see(row, col)) { ! mvaddch(row, col, gmc(monster)); } } *************** *** 284,292 **** while (orow!=row || ocol!=col) { get_dir_rc(dir, &orow, &ocol, 1); ! mvaddcch(orow, ocol, get_dungeon_char(orow, ocol)); /* ch = mvinch(orow, ocol); */ /* mvaddch(orow, ocol, ch); */ } ! mvaddcch(rogue.row, rogue.col, get_rogue_char()); refresh(); } --- 284,292 ---- while (orow!=row || ocol!=col) { get_dir_rc(dir, &orow, &ocol, 1); ! mvaddch(orow, ocol, get_dungeon_char(orow, ocol)); /* ch = mvinch(orow, ocol); */ /* mvaddch(orow, ocol, ch); */ } ! mvaddch(rogue.row, rogue.col, get_rogue_char()); refresh(); } *************** *** 341,346 **** const char *s; short damage; ! color_char cch; ! byte bolt_color; static short btime; --- 341,346 ---- const char *s; short damage; ! chtype cch; ! attr_t bolt_color; static short btime; *************** *** 353,366 **** if (ball == FIRE) { s = "fire"; ! bolt_color = MAKE_COLOR(BRIGHT_RED, BLACK); } else if (ball == COLD) { s = "ice"; ! bolt_color = MAKE_COLOR(BRIGHT_CYAN, BLACK); } else { /* for future wants of lightning, etc. */ s = "bolt"; ! bolt_color = MAKE_COLOR(BRIGHT_YELLOW, BLACK); } if (!use_color) { ! bolt_color = MAKE_COLOR(BRIGHT_WHITE, BLACK); } --- 353,366 ---- if (ball == FIRE) { s = "fire"; ! bolt_color = COLOR_PAIR(COLOR_RED); } else if (ball == COLD) { s = "ice"; ! bolt_color = COLOR_PAIR(COLOR_CYAN); } else { /* for future wants of lightning, etc. */ s = "bolt"; ! bolt_color = COLOR_PAIR(COLOR_YELLOW) | A_BOLD; } if (!use_color) { ! bolt_color = COLOR_PAIR(COLOR_WHITE) | A_BOLD; } *************** *** 370,376 **** do { get_dir_rc(dir, &row, &col, 1); ! cch = mvincch(row, col); ! cch.b8.color = bolt_color; ! mvaddcch(row, col, cch); } while (!( (col <= 0) || (col >= DCOLS-1) || --- 370,376 ---- do { get_dir_rc(dir, &row, &col, 1); ! cch = mvinch(row, col) | A_CHARTEXT; ! cch |= bolt_color; ! mvaddch(row, col, cch); } while (!( (col <= 0) || (col >= DCOLS-1) || Index: init.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/init.c,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** init.c 16 Jun 2008 04:42:04 -0000 1.9 --- init.c 18 Jun 2008 03:16:13 -0000 1.9.2.1 *************** *** 63,67 **** boolean use_doschars = 1; boolean use_color = 1; ! boolean beep = 0; char *byebye_string = "Okay, bye bye!"; --- 63,67 ---- boolean use_doschars = 1; boolean use_color = 1; ! boolean use_bell = 0; char *byebye_string = "Okay, bye bye!"; *************** *** 119,122 **** --- 119,137 ---- clean_up("must be played on 24 x 80 screen"); } + + if(has_colors()) { + start_color(); + + /* should check values of COLORS and COLOR_PAIRS here */ + init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK); + init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK); + init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK); + init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK); + init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK); + init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK); + init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK); + init_pair(COLOR_STAIRS, COLOR_BLACK, COLOR_GREEN); + } + start_window(); init_curses = 1; *************** *** 364,368 **** use_color = optval; } else if (!strncmp(eptr, "beep", 4)) { ! beep = optval; } } --- 379,383 ---- use_color = optval; } else if (!strncmp(eptr, "beep", 4)) { ! use_bell = optval; } } Index: object.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/object.c,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** object.c 16 Jun 2008 04:42:04 -0000 1.8 --- object.c 18 Jun 2008 03:16:13 -0000 1.8.2.1 *************** *** 674,678 **** { object *obj; ! color_char rc; short mc, row, col; object *monster; --- 674,678 ---- { object *obj; ! chtype rc; short mc, row, col; object *monster; *************** *** 688,692 **** if (dungeon[row][col] & MONSTER) { if (monster = object_at(&level_monsters, row, col)) { ! monster->trail_char.b16 = rc.b16; } } --- 688,692 ---- if (dungeon[row][col] & MONSTER) { if (monster = object_at(&level_monsters, row, col)) { ! monster->trail_char = rc; } } *************** *** 694,698 **** if (((mc < 'A') || (mc > 'Z')) && ((row != rogue.row) || (col != rogue.col))) { ! mvaddcch(row, col, rc); } obj = obj->next_object; --- 694,698 ---- if (((mc < 'A') || (mc > 'Z')) && ((row != rogue.row) || (col != rogue.col))) { ! mvaddch(row, col, rc); } obj = obj->next_object; *************** *** 703,708 **** while (monster) { if (monster->m_flags & IMITATES) { ! rc.b16 = gr_obj_char(monster->disguise).b16; ! mvaddcch(monster->row, monster->col, rc); } monster = monster->next_monster; --- 703,708 ---- while (monster) { if (monster->m_flags & IMITATES) { ! rc = gr_obj_char(monster->disguise); ! mvaddch(monster->row, monster->col, rc); } monster = monster->next_monster; *************** *** 819,823 **** short i = 0, j, maxlen = 0, n; char bwdesc[DCOLS]; ! color_char descs[MAX_PACK_COUNT+1][DCOLS]; short row, col; byte letter_color, protect_color, item_color; --- 819,823 ---- short i = 0, j, maxlen = 0, n; char bwdesc[DCOLS]; ! chtype descs[MAX_PACK_COUNT+1][DCOLS]; short row, col; byte letter_color, protect_color, item_color; *************** *** 865,869 **** obj = obj->next_object; } ! (void) colorize(press_space, MAKE_COLOR(WHITE, BLACK), descs[i++]); /* (void) strcpy(descs[i++], press_space); */ if (maxlen < 27) maxlen = 27; --- 865,869 ---- obj = obj->next_object; } ! (void) colorize(press_space, COLOR_PAIR(COLOR_WHITE), descs[i++]); /* (void) strcpy(descs[i++], press_space); */ if (maxlen < 27) maxlen = 27; *************** *** 873,881 **** if (row > 0) { for (j = col; j < DCOLS; j++) { ! descs[row-1][j-col].b16 = mvincch(row, j).b16; } descs[row-1][j-col].b16 = 0; } ! mvaddcstr(row, col, descs[row]); clrtoeol(); } --- 873,881 ---- if (row > 0) { for (j = col; j < DCOLS; j++) { ! descs[row-1][j-col].b16 = mvinch(row, j).b16; } descs[row-1][j-col].b16 = 0; } ! mvaddstr(row, col, descs[row]); clrtoeol(); } *************** *** 887,891 **** for (j = 1; ((j < i) && (j < DROWS)); j++) { ! mvaddcstr(j, col, descs[j-1]); } } --- 887,891 ---- for (j = 1; ((j < i) && (j < DROWS)); j++) { ! mvaddstr(j, col, descs[j-1]); } } *************** *** 1036,1040 **** short current_row_number, row_ctr, col_ctr, something_is_known; unsigned int ctr; ! color_char save[DROWS][DCOLS]; something_is_known = 0; --- 1036,1040 ---- short current_row_number, row_ctr, col_ctr, something_is_known; unsigned int ctr; ! chtype save[DROWS][DCOLS]; something_is_known = 0; *************** *** 1062,1066 **** for (col_ctr = 0; col_ctr < DCOLS; col_ctr++) { ! save[row_ctr][col_ctr] = mvincch(row_ctr, col_ctr); } } --- 1062,1066 ---- for (col_ctr = 0; col_ctr < DCOLS; col_ctr++) { ! save[row_ctr][col_ctr] = mvinch(row_ctr, col_ctr); } } *************** *** 1120,1128 **** for (col_ctr = 0; col_ctr < DCOLS; col_ctr++) { ! addcch(save[row_ctr][col_ctr]); } } ! redraw(); /*redraw screen*/ } --- 1120,1128 ---- for (col_ctr = 0; col_ctr < DCOLS; col_ctr++) { ! addch(save[row_ctr][col_ctr]); } } ! wrefresh(curscr); /*redraw screen*/ } Index: trap.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/trap.c,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** trap.c 13 Jun 2008 00:19:06 -0000 1.5 --- trap.c 18 Jun 2008 03:16:14 -0000 1.5.2.1 *************** *** 109,113 **** break; case TELE_TRAP: ! mvaddcch(rogue.row, rogue.col, get_terrain_char(TRAP)); tele(); break; --- 109,113 ---- break; case TELE_TRAP: ! mvaddch(rogue.row, rogue.col, get_terrain_char(TRAP)); tele(); break; *************** *** 218,222 **** for (j = 0; j < DCOLS; j++) { if (dungeon[i][j] & TRAP) { ! mvaddcch(i, j, get_terrain_char(TRAP)); } } --- 218,222 ---- for (j = 0; j < DCOLS; j++) { if (dungeon[i][j] & TRAP) { ! mvaddch(i, j, get_terrain_char(TRAP)); } } *************** *** 258,262 **** if ((!blind) && ((row != rogue.row) || (col != rogue.col))) { ! mvaddcch(row, col, get_dungeon_char(row, col)); } shown++; --- 258,262 ---- if ((!blind) && ((row != rogue.row) || (col != rogue.col))) { ! mvaddch(row, col, get_dungeon_char(row, col)); } shown++; Index: throw.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/throw.c,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** throw.c 11 Jun 2008 06:16:35 -0000 1.4 --- throw.c 18 Jun 2008 03:16:14 -0000 1.4.2.1 *************** *** 102,110 **** } monster = get_thrown_at_monster(weapon, d, &row, &col); ! mvaddcch(rogue.row, rogue.col, get_rogue_char()); refresh(); if (rogue_can_see(row, col) && ((row != rogue.row) || (col != rogue.col))){ ! mvaddcch(row, col, get_dungeon_char(row, col)); } if (monster) { --- 102,110 ---- } monster = get_thrown_at_monster(weapon, d, &row, &col); ! mvaddch(rogue.row, rogue.col, get_rogue_char()); refresh(); if (rogue_can_see(row, col) && ((row != rogue.row) || (col != rogue.col))){ ! mvaddch(row, col, get_dungeon_char(row, col)); } if (monster) { *************** *** 161,165 **** short orow, ocol; short i; ! color_char cc; orow = *row; ocol = *col; --- 161,165 ---- short orow, ocol; short i; ! chtype cc; orow = *row; ocol = *col; *************** *** 178,186 **** } if ((i != 0) && rogue_can_see(orow, ocol)) { ! mvaddcch(orow, ocol, get_dungeon_char(orow, ocol)); } if (rogue_can_see(*row, *col)) { if (!(dungeon[*row][*col] & MONSTER)) { ! mvaddcch(*row, *col, cc); } refresh(); --- 178,186 ---- } if ((i != 0) && rogue_can_see(orow, ocol)) { ! mvaddch(orow, ocol, get_dungeon_char(orow, ocol)); } if (rogue_can_see(*row, *col)) { if (!(dungeon[*row][*col] & MONSTER)) { ! mvaddch(*row, *col, cc); } refresh(); *************** *** 207,211 **** boolean found = 0; short mch; ! color_char dcch; unsigned short mon; --- 207,211 ---- boolean found = 0; short mch; ! chtype dcch; unsigned short mon; *************** *** 232,246 **** mon = dungeon[row][col] & MONSTER; dungeon[row][col] &= (~MONSTER); ! dcch.b16 = get_dungeon_char(row, col).b16; if (mon) { mch = (short) mvinch(row, col); if (monster = object_at(&level_monsters, row, col)) { ! monster->trail_char.b16 = dcch.b16; } if ((mch < 'A') || (mch > 'Z')) { ! mvaddcch(row, col, dcch); } } else { ! mvaddcch(row, col, dcch); } dungeon[row][col] |= mon; --- 232,246 ---- mon = dungeon[row][col] & MONSTER; dungeon[row][col] &= (~MONSTER); ! dcch = get_dungeon_char(row, col); if (mon) { mch = (short) mvinch(row, col); if (monster = object_at(&level_monsters, row, col)) { ! monster->trail_char = dcch; } if ((mch < 'A') || (mch > 'Z')) { ! mvaddch(row, col, dcch); } } else { ! mvaddch(row, col, dcch); } dungeon[row][col] |= mon; Index: invent.c =================================================================== RCS file: /cvsroot/rogueclone/rogue/src/invent.c,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** invent.c 13 Jun 2008 00:19:06 -0000 1.8 --- invent.c 18 Jun 2008 03:16:13 -0000 1.8.2.1 *************** *** 215,224 **** extern char *m_names[], *more; - - #define INV_LETTER_COLOR BRIGHT_MAGENTA - #define INV_PROTECT_COLOR BRIGHT_YELLOW - #define INV_ITEM_COLOR WHITE - - extern struct id id_scrolls[]; --- 215,218 ---- *************** *** 230,233 **** --- 224,236 ---- static int pr_motion_char(int ch); /* only used within this file */ + colorize(char *str, attr_t color, chtype *cstr) + { + while (*str != '\0') { + (*cstr) = *str | color; + str++; + cstr++; + } + (*cstr) = 0; + } *************** *** 237,243 **** short i = 0, j, maxlen = 0, n; char bwdesc[DCOLS]; ! color_char descs[MAX_PACK_COUNT+1][DCOLS]; short row, col; ! byte letter_color, protect_color, item_color; obj = pack->next_object; --- 240,246 ---- short i = 0, j, maxlen = 0, n; char bwdesc[DCOLS]; ! chtype descs[MAX_PACK_COUNT+1][DCOLS]; short row, col; ! attr_t letter_color, protect_color, item_color; obj = pack->next_object; *************** *** 249,276 **** if (use_color) { ! letter_color = MAKE_COLOR(INV_LETTER_COLOR, BLACK); ! protect_color = MAKE_COLOR(INV_PROTECT_COLOR, BLACK); ! item_color = MAKE_COLOR(INV_ITEM_COLOR, BLACK); } else { ! letter_color = MAKE_COLOR(WHITE,BLACK); ! protect_color = MAKE_COLOR(WHITE,BLACK); ! item_color = MAKE_COLOR(WHITE,BLACK); } while (obj) { if (obj->what_is & mask) { ! descs[i][0].b8.color = MAKE_COLOR(WHITE, BLACK); ! descs[i][0].b8.ch = ' '; ! descs[i][1].b8.color = letter_color; ! descs[i][1].b8.ch = (char) obj->ichar; if ((obj->what_is & ARMOR) && obj->is_protected) { ! descs[i][2].b8.color = protect_color; ! descs[i][2].b8.ch = '}'; } else { ! descs[i][2].b8.color = letter_color; ! descs[i][2].b8.ch = ')'; } ! descs[i][3].b8.color = MAKE_COLOR(WHITE, BLACK); ! descs[i][3].b8.ch = ' '; get_desc(obj, bwdesc); --- 252,274 ---- if (use_color) { ! letter_color = COLOR_PAIR(COLOR_MAGENTA) | A_BOLD; ! protect_color = COLOR_PAIR(COLOR_YELLOW) | A_BOLD; ! item_color = COLOR_PAIR(COLOR_WHITE); } else { ! letter_color = COLOR_PAIR(COLOR_WHITE); ! protect_color = COLOR_PAIR(COLOR_WHITE); ! item_color = COLOR_PAIR(COLOR_WHITE); } while (obj) { if (obj->what_is & mask) { ! descs[i][0] = COLOR_PAIR(COLOR_WHITE) | ' '; ! descs[i][1] = letter_color | obj->ichar; if ((obj->what_is & ARMOR) && obj->is_protected) { ! descs[i][2] = protect_color | '}'; } else { ! descs[i][2] = letter_color | ')'; } ! descs[i][3] = COLOR_PAIR(COLOR_WHITE) | ' '; get_desc(obj, bwdesc); *************** *** 283,288 **** obj = obj->next_object; } ! (void) colorize(press_space, MAKE_COLOR(WHITE, BLACK), descs[i++]); ! /* (void) strcpy(descs[i++], press_space); */ if (maxlen < 27) maxlen = 27; col = DCOLS - (maxlen + 2); --- 281,285 ---- obj = obj->next_object; } ! (void) colorize(press_space, COLOR_PAIR(COLOR_WHITE), descs[i++]); if (maxlen < 27) maxlen = 27; co... [truncated message content] |