From: Pasi Kallinen Date: Tue, 7 Apr 2015 17:12:53 +0000 (+0300) Subject: Clive Crous' Dark Room patch X-Git-Tag: NetHack-3.6.0_RC01~488^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c967dabc0b147249b3b779783ec274e79343deb4;p=nethack Clive Crous' Dark Room patch This patch adds a new glyph that represents dark parts of room, splitting the dual functionality of the "unexplored/dark area" glyph. --- diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 5b6cd229e..06db99247 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1952,6 +1952,8 @@ new players if it detects some anticipated mistakes (default on). .lp "confirm " Have user confirm attacks on pets, shopkeepers, and other peaceable creatures (default on). +.lp dark_room +Show out-of-sight areas of lit rooms (default off). .lp disclose Controls what information the program reveals when the game ends. Value is a space separated list of prompting/category pairs diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 4073ab71b..427d720a0 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -2363,6 +2363,9 @@ players if it detects some anticipated mistakes (default on). Have user confirm attacks on pets, shopkeepers, and other peaceable creatures (default on). %.lp +%.lp +\item[\ib{dark\_room}] +Show out-of-sight areas of lit rooms (default off). \item[\ib{disclose}] Controls what information the program reveals when the game ends. Value is a space separated list of prompting/category pairs diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 4e81689ee..96dc67f9d 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -1151,6 +1151,7 @@ adopt/adapt/improve the Paranoid_Quit patch; default is paranoid_confirm:pray adopt/adapt/improve Dungeon Overview Aardvark Joe's Extended Logfile Michael Deutschmann's use_darkgray +Clive Crous' dark_room Code Cleanup and Reorganization diff --git a/include/flag.h b/include/flag.h index 072fb4a30..734806b38 100644 --- a/include/flag.h +++ b/include/flag.h @@ -23,6 +23,7 @@ struct flag { boolean biff; /* enable checking for mail */ boolean bones; /* allow saving/loading bones */ boolean confirm; /* confirm before hitting tame monsters */ + boolean dark_room; /* show shadows in lit rooms */ boolean debug; /* in debugging mode */ #define wizard flags.debug boolean end_own; /* list all own scores */ diff --git a/include/rm.h b/include/rm.h index 4e57998f1..86474c9ca 100644 --- a/include/rm.h +++ b/include/rm.h @@ -128,99 +128,102 @@ #define S_bars 17 /* KMH -- iron bars */ #define S_tree 18 /* KMH */ #define S_room 19 -#define S_corr 20 -#define S_litcorr 21 -#define S_upstair 22 -#define S_dnstair 23 -#define S_upladder 24 -#define S_dnladder 25 -#define S_altar 26 -#define S_grave 27 -#define S_throne 28 -#define S_sink 29 -#define S_fountain 30 -#define S_pool 31 -#define S_ice 32 -#define S_lava 33 -#define S_vodbridge 34 -#define S_hodbridge 35 -#define S_vcdbridge 36 /* closed drawbridge, vertical wall */ -#define S_hcdbridge 37 /* closed drawbridge, horizontal wall */ -#define S_air 38 -#define S_cloud 39 -#define S_water 40 +#define S_darkroom 20 +#define S_corr 21 +#define S_litcorr 22 +#define S_upstair 23 +#define S_dnstair 24 +#define S_upladder 25 +#define S_dnladder 26 +#define S_altar 27 +#define S_grave 28 +#define S_throne 29 +#define S_sink 30 +#define S_fountain 31 +#define S_pool 32 +#define S_ice 33 +#define S_lava 34 +#define S_vodbridge 35 +#define S_hodbridge 36 +#define S_vcdbridge 37 /* closed drawbridge, vertical wall */ +#define S_hcdbridge 38 /* closed drawbridge, horizontal wall */ +#define S_air 39 +#define S_cloud 40 +#define S_water 41 /* end dungeon characters, begin traps */ -#define S_arrow_trap 41 -#define S_dart_trap 42 -#define S_falling_rock_trap 43 -#define S_squeaky_board 44 -#define S_bear_trap 45 -#define S_land_mine 46 -#define S_rolling_boulder_trap 47 -#define S_sleeping_gas_trap 48 -#define S_rust_trap 49 -#define S_fire_trap 50 -#define S_pit 51 -#define S_spiked_pit 52 -#define S_hole 53 -#define S_trap_door 54 -#define S_teleportation_trap 55 -#define S_level_teleporter 56 -#define S_magic_portal 57 -#define S_web 58 -#define S_statue_trap 59 -#define S_magic_trap 60 -#define S_anti_magic_trap 61 -#define S_polymorph_trap 62 +#define S_arrow_trap 42 +#define S_dart_trap 43 +#define S_falling_rock_trap 44 +#define S_squeaky_board 45 +#define S_bear_trap 46 +#define S_land_mine 47 +#define S_rolling_boulder_trap 48 +#define S_sleeping_gas_trap 49 +#define S_rust_trap 50 +#define S_fire_trap 51 +#define S_pit 52 +#define S_spiked_pit 53 +#define S_hole 54 +#define S_trap_door 55 +#define S_teleportation_trap 56 +#define S_level_teleporter 57 +#define S_magic_portal 58 +#define S_web 59 +#define S_statue_trap 60 +#define S_magic_trap 61 +#define S_anti_magic_trap 62 +#define S_polymorph_trap 63 /* end traps, begin special effects */ -#define S_vbeam 63 /* The 4 zap beam symbols. Do NOT separate. */ -#define S_hbeam 64 /* To change order or add, see function */ -#define S_lslant 65 /* zapdir_to_glyph() in display.c. */ -#define S_rslant 66 -#define S_digbeam 67 /* dig beam symbol */ -#define S_flashbeam 68 /* camera flash symbol */ -#define S_boomleft 69 /* thrown boomerang, open left, e.g ')' */ -#define S_boomright 70 /* thrown boomerand, open right, e.g. '(' */ -#define S_ss1 71 /* 4 magic shield glyphs */ -#define S_ss2 72 -#define S_ss3 73 -#define S_ss4 74 -#define S_poisoncloud 75 -#define S_goodpos 76 /* valid position for targeting */ +#define S_vbeam 64 /* The 4 zap beam symbols. Do NOT separate. */ +#define S_hbeam 65 /* To change order or add, see function */ +#define S_lslant 66 /* zapdir_to_glyph() in display.c. */ +#define S_rslant 67 +#define S_digbeam 68 /* dig beam symbol */ +#define S_flashbeam 69 /* camera flash symbol */ +#define S_boomleft 70 /* thrown boomerang, open left, e.g ')' */ +#define S_boomright 71 /* thrown boomerand, open right, e.g. '(' */ +#define S_ss1 72 /* 4 magic shield glyphs */ +#define S_ss2 73 +#define S_ss3 74 +#define S_ss4 75 +#define S_poisoncloud 76 +#define S_goodpos 77 /* valid position for targeting */ /* The 8 swallow symbols. Do NOT separate. To change order or add, see */ /* the function swallow_to_glyph() in display.c. */ -#define S_sw_tl 77 /* swallow top left [1] */ -#define S_sw_tc 78 /* swallow top center [2] Order: */ -#define S_sw_tr 79 /* swallow top right [3] */ -#define S_sw_ml 80 /* swallow middle left [4] 1 2 3 */ -#define S_sw_mr 81 /* swallow middle right [6] 4 5 6 */ -#define S_sw_bl 82 /* swallow bottom left [7] 7 8 9 */ -#define S_sw_bc 83 /* swallow bottom center [8] */ -#define S_sw_br 84 /* swallow bottom right [9] */ - -#define S_explode1 85 /* explosion top left */ -#define S_explode2 86 /* explosion top center */ -#define S_explode3 87 /* explosion top right Ex. */ -#define S_explode4 88 /* explosion middle left */ -#define S_explode5 89 /* explosion middle center /-\ */ -#define S_explode6 90 /* explosion middle right |@| */ -#define S_explode7 91 /* explosion bottom left \-/ */ -#define S_explode8 92 /* explosion bottom center */ -#define S_explode9 93 /* explosion bottom right */ +#define S_sw_tl 78 /* swallow top left [1] */ +#define S_sw_tc 79 /* swallow top center [2] Order: */ +#define S_sw_tr 80 /* swallow top right [3] */ +#define S_sw_ml 81 /* swallow middle left [4] 1 2 3 */ +#define S_sw_mr 82 /* swallow middle right [6] 4 5 6 */ +#define S_sw_bl 83 /* swallow bottom left [7] 7 8 9 */ +#define S_sw_bc 84 /* swallow bottom center [8] */ +#define S_sw_br 85 /* swallow bottom right [9] */ + +#define S_explode1 86 /* explosion top left */ +#define S_explode2 87 /* explosion top center */ +#define S_explode3 88 /* explosion top right Ex. */ +#define S_explode4 89 /* explosion middle left */ +#define S_explode5 90 /* explosion middle center /-\ */ +#define S_explode6 91 /* explosion middle right |@| */ +#define S_explode7 92 /* explosion bottom left \-/ */ +#define S_explode8 93 /* explosion bottom center */ +#define S_explode9 94 /* explosion bottom right */ /* end effects */ -#define MAXPCHARS 94 /* maximum number of mapped characters */ -#define MAXDCHARS 41 /* maximum of mapped dungeon characters */ +#define MAXPCHARS 95 /* maximum number of mapped characters */ +#define MAXDCHARS 42 /* maximum of mapped dungeon characters */ #define MAXTCHARS 22 /* maximum of mapped trap characters */ #define MAXECHARS 31 /* maximum of mapped effects characters */ #define MAXEXPCHARS 9 /* number of explosion characters */ +#define DARKROOMSYM (Is_rogue_level(&u.uz) ? S_stone : S_darkroom) + struct symdef { uchar sym; const char *explanation; diff --git a/src/display.c b/src/display.c index da5c194e7..75af16442 100644 --- a/src/display.c +++ b/src/display.c @@ -764,11 +764,11 @@ newsym(x,y) * These checks and changes must be here and not in back_to_glyph(). * They are dependent on the position being out of sight. */ - else if (!lev->waslit) { + else if (!lev->waslit || (flags.dark_room && iflags.use_color)) { if (lev->glyph == cmap_to_glyph(S_litcorr) && lev->typ == CORR) show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr)); else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM) - show_glyph(x, y, lev->glyph = cmap_to_glyph(S_stone)); + show_glyph(x, y, lev->glyph = cmap_to_glyph(DARKROOMSYM)); else goto show_mem; } else { diff --git a/src/do_name.c b/src/do_name.c index b5c2bb711..1437680e7 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -238,6 +238,7 @@ const char *goal; if (glyph_is_cmap(k) && (IS_DOOR(levl[tx][ty].typ) || glyph_to_cmap(k) == S_room || + glyph_to_cmap(k) == S_darkroom || glyph_to_cmap(k) == S_corr || glyph_to_cmap(k) == S_litcorr)) { /* what the hero remembers to be at tx,ty */ diff --git a/src/drawing.c b/src/drawing.c index 2f538c866..d78668e0a 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -156,7 +156,8 @@ const struct symdef defsyms[MAXPCHARS] = { {'#', "iron bars", C(HI_METAL)}, /* bars */ {'#', "tree", C(CLR_GREEN)}, /* tree */ {'.', "floor of a room",C(CLR_GRAY)}, /* room */ -/*20*/ {'#', "corridor", C(CLR_GRAY)}, /* dark corr */ +/*20*/ {'.', "dark part of a room",C(CLR_BLACK)}, /* dark room */ + {'#', "corridor", C(CLR_GRAY)}, /* dark corr */ {'#', "lit corridor", C(CLR_GRAY)}, /* lit corr (see mapglyph.c) */ {'<', "staircase up", C(CLR_GRAY)}, /* upstair */ {'>', "staircase down", C(CLR_GRAY)}, /* dnstair */ @@ -165,8 +166,8 @@ const struct symdef defsyms[MAXPCHARS] = { {'_', "altar", C(CLR_GRAY)}, /* altar */ {'|', "grave", C(CLR_GRAY)}, /* grave */ {'\\', "opulent throne",C(HI_GOLD)}, /* throne */ - {'#', "sink", C(CLR_GRAY)}, /* sink */ -/*30*/ {'{', "fountain", C(CLR_BLUE)}, /* fountain */ +/*30*/ {'#', "sink", C(CLR_GRAY)}, /* sink */ + {'{', "fountain", C(CLR_BLUE)}, /* fountain */ {'}', "water", C(CLR_BLUE)}, /* pool */ {'.', "ice", C(CLR_CYAN)}, /* ice */ {'}', "molten lava", C(CLR_RED)}, /* lava */ @@ -175,8 +176,8 @@ const struct symdef defsyms[MAXPCHARS] = { {'#', "raised drawbridge",C(CLR_BROWN)}, /* vcdbridge */ {'#', "raised drawbridge",C(CLR_BROWN)}, /* hcdbridge */ {' ', "air", C(CLR_CYAN)}, /* open air */ - {'#', "cloud", C(CLR_GRAY)}, /* [part of] a cloud */ -/*40*/ {'}', "water", C(CLR_BLUE)}, /* under water */ +/*40*/ {'#', "cloud", C(CLR_GRAY)}, /* [part of] a cloud */ + {'}', "water", C(CLR_BLUE)}, /* under water */ {'^', "arrow trap", C(HI_METAL)}, /* trap */ {'^', "dart trap", C(HI_METAL)}, /* trap */ {'^', "falling rock trap",C(CLR_GRAY)}, /* trap */ @@ -185,8 +186,8 @@ const struct symdef defsyms[MAXPCHARS] = { {'^', "land mine", C(CLR_RED)}, /* trap */ {'^', "rolling boulder trap", C(CLR_GRAY)}, /* trap */ {'^', "sleeping gas trap",C(HI_ZAP)}, /* trap */ - {'^', "rust trap", C(CLR_BLUE)}, /* trap */ -/*50*/ {'^', "fire trap", C(CLR_ORANGE)}, /* trap */ +/*50*/ {'^', "rust trap", C(CLR_BLUE)}, /* trap */ + {'^', "fire trap", C(CLR_ORANGE)}, /* trap */ {'^', "pit", C(CLR_BLACK)}, /* trap */ {'^', "spiked pit", C(CLR_BLACK)}, /* trap */ {'^', "hole", C(CLR_BROWN)}, /* trap */ @@ -195,8 +196,8 @@ const struct symdef defsyms[MAXPCHARS] = { {'^', "level teleporter", C(CLR_MAGENTA)}, /* trap */ {'^', "magic portal", C(CLR_BRIGHT_MAGENTA)}, /* trap */ {'"', "web", C(CLR_GRAY)}, /* web */ - {'^', "statue trap", C(CLR_GRAY)}, /* trap */ -/*60*/ {'^', "magic trap", C(HI_ZAP)}, /* trap */ +/*60*/ {'^', "statue trap", C(CLR_GRAY)}, /* trap */ + {'^', "magic trap", C(HI_ZAP)}, /* trap */ {'^', "anti-magic field", C(HI_ZAP)}, /* trap */ {'^', "polymorph trap", C(CLR_BRIGHT_GREEN)}, /* trap */ {'|', "wall", C(CLR_GRAY)}, /* vbeam */ @@ -205,8 +206,8 @@ const struct symdef defsyms[MAXPCHARS] = { {'/', "wall", C(CLR_GRAY)}, /* rslant */ {'*', "", C(CLR_WHITE)}, /* dig beam */ {'!', "", C(CLR_WHITE)}, /* camera flash beam */ - {')', "", C(HI_WOOD)}, /* boomerang open left */ -/*70*/ {'(', "", C(HI_WOOD)}, /* boomerang open right */ +/*70*/ {')', "", C(HI_WOOD)}, /* boomerang open left */ + {'(', "", C(HI_WOOD)}, /* boomerang open right */ {'0', "", C(HI_ZAP)}, /* 4 magic shield symbols */ {'#', "", C(HI_ZAP)}, {'@', "", C(HI_ZAP)}, @@ -215,20 +216,20 @@ const struct symdef defsyms[MAXPCHARS] = { {'?', "valid position", C(CLR_BRIGHT_GREEN)}, /* valid position for targeting */ {'/', "", C(CLR_GREEN)}, /* swallow top left */ {'-', "", C(CLR_GREEN)}, /* swallow top center */ - {'\\', "", C(CLR_GREEN)}, /* swallow top right */ +/*80*/ {'\\', "", C(CLR_GREEN)}, /* swallow top right */ {'|', "", C(CLR_GREEN)}, /* swallow middle left */ {'|', "", C(CLR_GREEN)}, /* swallow middle right */ -/*80*/ {'\\', "", C(CLR_GREEN)}, /* swallow bottom left */ + {'\\', "", C(CLR_GREEN)}, /* swallow bottom left */ {'-', "", C(CLR_GREEN)}, /* swallow bottom center*/ {'/', "", C(CLR_GREEN)}, /* swallow bottom right */ {'/', "", C(CLR_ORANGE)}, /* explosion top left */ {'-', "", C(CLR_ORANGE)}, /* explosion top center */ {'\\', "", C(CLR_ORANGE)}, /* explosion top right */ {'|', "", C(CLR_ORANGE)}, /* explosion middle left */ - {' ', "", C(CLR_ORANGE)}, /* explosion middle center*/ +/*90*/ {' ', "", C(CLR_ORANGE)}, /* explosion middle center*/ {'|', "", C(CLR_ORANGE)}, /* explosion middle right */ {'\\', "", C(CLR_ORANGE)}, /* explosion bottom left */ -/*90*/ {'-', "", C(CLR_ORANGE)}, /* explosion bottom center*/ + {'-', "", C(CLR_ORANGE)}, /* explosion bottom center*/ {'/', "", C(CLR_ORANGE)}, /* explosion bottom right */ }; diff --git a/src/mapglyph.c b/src/mapglyph.c index e44265d3a..08b6240f3 100644 --- a/src/mapglyph.c +++ b/src/mapglyph.c @@ -116,7 +116,7 @@ unsigned *ospecial; color = CLR_MAGENTA; else if (offset == S_corr || offset == S_litcorr) color = CLR_GRAY; - else if (offset >= S_room && offset <= S_water) + else if (offset >= S_room && offset <= S_water && offset != S_darkroom) color = CLR_GREEN; else color = NO_COLOR; diff --git a/src/options.c b/src/options.c index 54e0471e8..1b834e616 100644 --- a/src/options.c +++ b/src/options.c @@ -105,6 +105,7 @@ static struct Bool_Opt {"color", &iflags.wc_color, FALSE, SET_IN_GAME}, /*WC*/ # endif {"confirm",&flags.confirm, TRUE, SET_IN_GAME}, + {"dark_room", &flags.dark_room, TRUE, SET_IN_GAME}, {"eight_bit_tty", &iflags.wc_eight_bit_input, FALSE, SET_IN_GAME}, /*WC*/ #ifdef TTY_GRAPHICS {"extmenu", &iflags.extmenu, FALSE, SET_IN_GAME}, @@ -496,6 +497,35 @@ STATIC_OVL boolean FDECL(wc2_supported, (const char *)); STATIC_DCL void FDECL(remove_autopickup_exception, (struct autopickup_exception *)); STATIC_OVL int FDECL(count_ape_maps, (int *, int *)); + +void +reglyph_darkroom() +{ + xchar x,y; + for (x = 0; x < COLNO; x++) + for (y = 0; y < ROWNO; y++) { + struct rm *lev = &levl[x][y]; + if (!flags.dark_room) { + if (lev->glyph == cmap_to_glyph(S_darkroom)) + lev->glyph = lev->waslit ? cmap_to_glyph(S_room) : cmap_to_glyph(S_stone); + } else { + if (lev->glyph == cmap_to_glyph(S_room) && + lev->seenv && + lev->waslit && !cansee(x,y)) + lev->glyph = cmap_to_glyph(S_darkroom); + else if (lev->glyph == cmap_to_glyph(S_stone) && + lev->typ == ROOM && + lev->seenv && + !cansee(x,y)) + lev->glyph = cmap_to_glyph(S_darkroom); + } + } + if (flags.dark_room && iflags.use_color) + showsyms[S_darkroom]=showsyms[S_room]; + else + showsyms[S_darkroom]=showsyms[S_stone]; +} + /* check whether a user-supplied option string is a proper leading substring of a particular option name; option string might have a colon or equals sign and arbitrary value appended to it */ @@ -704,6 +734,8 @@ initoptions_finish() /* result in the player's preferred fruit [better than "\033"]. */ obj_descr[SLIME_MOLD].oc_name = "fruit"; + reglyph_darkroom(); + return; } @@ -2810,7 +2842,8 @@ goodfruit: else if ((boolopt[i].addr) == &flags.invlet_constant) { if (flags.invlet_constant) reassign(); } - else if ((boolopt[i].addr) == &flags.lit_corridor) { + else if (((boolopt[i].addr) == &flags.lit_corridor) || + ((boolopt[i].addr) == &flags.dark_room)) { /* * All corridor squares seen via night vision or * candles & lamps change. Update them by calling @@ -2820,6 +2853,7 @@ goodfruit: */ vision_recalc(2); /* shut down vision */ vision_full_recalc = 1; /* delayed recalc */ + if (iflags.use_color) need_redraw = TRUE; /* darkroom refresh */ } else if ((boolopt[i].addr) == &iflags.use_inverse || (boolopt[i].addr) == &flags.showrace || @@ -3149,8 +3183,10 @@ doset() } destroy_nhwindow(tmpwin); - if (need_redraw) + if (need_redraw) { + reglyph_darkroom(); (void) doredraw(); + } return 0; } diff --git a/src/pager.c b/src/pager.c index 4c0f69d17..280cf0a05 100644 --- a/src/pager.c +++ b/src/pager.c @@ -250,7 +250,7 @@ lookat(x, y, buf, monbuf) int tnum = what_trap(glyph_to_trap(glyph)); Strcpy(buf, defsyms[trap_to_defsym(tnum)].explanation); } else if(!glyph_is_cmap(glyph)) { - Strcpy(buf,"dark part of a room"); + Strcpy(buf,"unexplored area"); } else switch(glyph_to_cmap(glyph)) { case S_altar: Sprintf(buf, "%s %saltar", @@ -557,8 +557,8 @@ const char **firstmatch; x_str = defsyms[i].explanation; if (sym == ((looked) ? showsyms[i] : defsyms[i].sym) && *x_str) { - /* avoid "an air", "a water", or "a floor of a room" */ - int article = (i == S_room) ? 2 : /* 2=>"the" */ + /* avoid "an air", "a water", "a floor of a room", "a dark part of a room" */ + int article = ((i == S_room)||(i == S_darkroom)) ? 2 : /* 2=>"the" */ !(strcmp(x_str, "air") == 0 || /* 1=>"an" */ strcmp(x_str, "water") == 0); /* 0=>(none)*/ diff --git a/win/share/other.txt b/win/share/other.txt index f2bcd148d..f6ecc3a9c 100644 --- a/win/share/other.txt +++ b/win/share/other.txt @@ -394,6 +394,25 @@ P = (108, 145, 182) MMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMM } +# tile 20 (dark part of a room) +{ + MAMAMAMAMAMAMAMA + AMAMAMAMAMAMAMAM + MAMAMAMAMAMAMAMA + AMAMAMAMAMAMAMAM + MAMAMAMAMAMAMAMA + AMAMAMAMAMAMAMAM + MAMAMAMAMAMAMAMA + AMAMAMAPPMAMAMAM + MAMAMAMPPAMAMAMA + AMAMAMAMAMAMAMAM + MAMAMAMAMAMAMAMA + AMAMAMAMAMAMAMAM + MAMAMAMAMAMAMAMA + AMAMAMAMAMAMAMAM + MAMAMAMAMAMAMAMA + AMAMAMAMAMAMAMAM +} # tile 20 (corridor) { MMMMMMMMMMMMMMMM