diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 94986c5b0..15d5b2d6d 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -234,6 +234,8 @@ dismount that kills steed because there is no room to put it on map blamed the to emphasize that it's not a light source, change description of wielded Sting from "(glowing light blue)" to "(light blue aura)" when sighted and from "(glowing)" to nothing (not warm enough to feel) when blind +glowing Sting quivers if hero becomes blind and quivering Sting glows if + blindness ends; it worked for timed blindness but not for blindfold Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository @@ -253,6 +255,9 @@ life-saving while poly'd and Unchanging wasn't restoring u.mh (HP as monster) change in searching stopped finding unseen monsters except hiders and eels buliding with EXTRA_SANITY_CHECKS enabled would issue "no monster to remove" warning if steed was killed out from under the hero +changing Sting's description to be "(weapon in hand) (light blue aura)" was + too close to feedback when objects become blessed; change it again, + to "(weapon in hand, flickering/glimmering/gleaming light blue)" tty: turn off an optimization that is the suspected cause of Windows reported partial status lines following level changes tty: ensure that current status fields are always copied to prior status diff --git a/include/extern.h b/include/extern.h index 7a9299754..dd703e101 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1543185068 2018/11/25 22:31:08 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.663 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1543745352 2018/12/02 10:09:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.664 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -90,6 +90,7 @@ E boolean FDECL(artifact_has_invprop, (struct obj *, UCHAR_P)); E long FDECL(arti_cost, (struct obj *)); E struct obj *FDECL(what_gives, (long *)); E const char *FDECL(glow_color, (int)); +E const char *FDECL(glow_verb, (int, BOOLEAN_P)); E void FDECL(Sting_effects, (int)); E int FDECL(retouch_object, (struct obj **, BOOLEAN_P)); E void FDECL(retouch_equipment, (int)); @@ -1915,11 +1916,12 @@ E void FDECL(set_itimeout, (long *, long)); E void FDECL(incr_itimeout, (long *, int)); E void FDECL(make_confused, (long, BOOLEAN_P)); E void FDECL(make_stunned, (long, BOOLEAN_P)); -E void FDECL(make_blinded, (long, BOOLEAN_P)); E void FDECL(make_sick, (long, const char *, BOOLEAN_P, int)); E void FDECL(make_slimed, (long, const char *)); E void FDECL(make_stoned, (long, const char *, int, const char *)); E void FDECL(make_vomiting, (long, BOOLEAN_P)); +E void FDECL(make_blinded, (long, BOOLEAN_P)); +E void NDECL(toggle_blindness); E boolean FDECL(make_hallucinated, (long, BOOLEAN_P, long)); E void FDECL(make_deaf, (long, BOOLEAN_P)); E void NDECL(self_invis_message); diff --git a/include/ntconf.h b/include/ntconf.h index bf98fec65..6859d52b0 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -5,7 +5,7 @@ #ifndef NTCONF_H #define NTCONF_H -/* #define SHELL /* nt use of pcsys routines caused a hang */ +/* #define SHELL */ /* nt use of pcsys routines caused a hang */ #define RANDOM /* have Berkeley random(3) */ #define TEXTCOLOR /* Color text */ @@ -43,7 +43,7 @@ * The remaining code shouldn't need modification. * ----------------------------------------------------------------- */ -/* #define SHORT_FILENAMES /* All NT filesystems support long names now +/* #define SHORT_FILENAMES */ /* All NT filesystems support long names now */ #ifdef MICRO @@ -143,12 +143,14 @@ extern void FDECL(interject, (int)); #define strncmpi(a, b, c) strnicmp(a, b, c) #endif +#ifdef _MSC_VER /* Visual Studio defines this in their own headers, which we don't use */ #ifndef snprintf #define snprintf _snprintf #pragma warning( \ disable : 4996) /* deprecation warning suggesting snprintf_s */ #endif +#endif #include #include diff --git a/include/winprocs.h b/include/winprocs.h index 326f44eb2..316af5171 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -260,6 +260,11 @@ struct wc_Opt { unsigned long wc_bit; }; +/* Macro for the currently active Window Port whose function + pointers have been loaded */ +#define WINDOWPORT(wn) \ + (windowprocs.name && !strncmpi((wn), windowprocs.name, strlen((wn)))) + /* role selection by player_selection(); this ought to be in the core... */ #define RS_NAME 0 #define RS_ROLE 1 diff --git a/src/artifact.c b/src/artifact.c index 87cbf3b61..80332f325 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 artifact.c $NHDT-Date: 1509836679 2017/11/04 23:04:39 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.106 $ */ +/* NetHack 3.6 artifact.c $NHDT-Date: 1543745353 2018/12/02 10:09:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.127 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -27,6 +27,7 @@ STATIC_DCL boolean FDECL(Mb_hit, (struct monst * magr, struct monst *mdef, struct obj *, int *, int, BOOLEAN_P, char *)); STATIC_DCL unsigned long FDECL(abil_to_spfx, (long *)); STATIC_DCL uchar FDECL(abil_to_adtyp, (long *)); +STATIC_DCL int FDECL(glow_strength, (int)); STATIC_DCL boolean FDECL(untouchable, (struct obj *, BOOLEAN_P)); STATIC_DCL int FDECL(count_surround_traps, (int, int)); @@ -1852,6 +1853,37 @@ int arti_indx; return hcolor(colorstr); } +/* glow verb; [0] holds the value used when blind */ +static const char *glow_verbs[] = { + "quiver", "flicker", "glimmer", "gleam" +}; + +/* relative strength that Sting is glowing (0..3), to select verb */ +STATIC_OVL int +glow_strength(count) +int count; +{ + /* glow strength should also be proportional to proximity and + probably difficulty, but we don't have that information and + gathering it is more trouble than this would be worth */ + return (count > 12) ? 3 : (count > 4) ? 2 : (count > 0); +} + +const char * +glow_verb(count, ingsfx) +int count; /* 0 means blind rather than no applicable creatures */ +boolean ingsfx; +{ + static char resbuf[20]; + + Strcpy(resbuf, glow_verbs[glow_strength(count)]); + /* ing_suffix() will double the last consonant for all the words + we're using and none of them should have that, so bypass it */ + if (ingsfx) + Strcat(resbuf, "ing"); + return resbuf; +} + /* use for warning "glow" for Sting, Orcrist, and Grimtooth */ void Sting_effects(orc_count) @@ -1861,22 +1893,28 @@ int orc_count; /* new count (warn_obj_cnt is old count); -1 is a flag value */ && (uwep->oartifact == ART_STING || uwep->oartifact == ART_ORCRIST || uwep->oartifact == ART_GRIMTOOTH)) { + int oldstr = glow_strength(warn_obj_cnt), + newstr = glow_strength(orc_count); + if (orc_count == -1 && warn_obj_cnt > 0) { /* -1 means that blindness has just been toggled; give a 'continue' message that eventual 'stop' message will match */ pline("%s is %s.", bare_artifactname(uwep), - !Blind ? "glowing" : "quivering"); - } else if (orc_count > 0 && warn_obj_cnt == 0) { + glow_verb(Blind ? 0 : warn_obj_cnt, TRUE)); + } else if (newstr > 0 && newstr != oldstr) { /* 'start' message */ if (!Blind) - pline("%s %s %s!", bare_artifactname(uwep), - otense(uwep, "glow"), glow_color(uwep->oartifact)); - else - pline("%s quivers slightly.", bare_artifactname(uwep)); + pline("%s %s %s%c", bare_artifactname(uwep), + otense(uwep, glow_verb(orc_count, FALSE)), + glow_color(uwep->oartifact), + (newstr > oldstr) ? '!' : '.'); + else if (oldstr == 0) /* quivers */ + pline("%s %s slightly.", bare_artifactname(uwep), + otense(uwep, glow_verb(0, FALSE))); } else if (orc_count == 0 && warn_obj_cnt > 0) { /* 'stop' message */ pline("%s stops %s.", bare_artifactname(uwep), - !Blind ? "glowing" : "quivering"); + glow_verb(Blind ? 0 : warn_obj_cnt, TRUE)); } } } diff --git a/src/bones.c b/src/bones.c index 7b694473d..ed39bf427 100644 --- a/src/bones.c +++ b/src/bones.c @@ -193,7 +193,7 @@ sanitize_name(namebuf) char *namebuf; { int c; - boolean strip_8th_bit = (!strcmp(windowprocs.name, "tty") + boolean strip_8th_bit = (WINDOWPORT("tty") && !iflags.wc_eight_bit_input); /* it's tempting to skip this for single-user platforms, since diff --git a/src/cmd.c b/src/cmd.c index eba20ccd3..20327366c 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1542673290 2018/11/20 00:21:30 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.302 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1543711385 2018/12/02 00:43:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.309 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -176,9 +176,6 @@ STATIC_DCL void FDECL(contained_stats, (winid, const char *, long *, long *)); STATIC_DCL void FDECL(misc_stats, (winid, long *, long *)); STATIC_PTR int NDECL(wiz_show_stats); STATIC_DCL boolean FDECL(accept_menu_prefix, (int NDECL((*)))); -#ifdef PORT_DEBUG -STATIC_DCL int NDECL(wiz_port_debug); -#endif STATIC_PTR int NDECL(wiz_rumor_check); STATIC_PTR int NDECL(doattributes); @@ -1052,7 +1049,7 @@ wiz_show_wmodes(VOID_ARGS) int x, y; char row[COLNO + 1]; struct rm *lev; - boolean istty = !strcmp(windowprocs.name, "tty"); + boolean istty = WINDOWPORT("tty"); win = create_nhwindow(NHW_TEXT); if (istty) @@ -3272,10 +3269,6 @@ struct ext_func_tab extcmdlist[] = { { ',', "pickup", "pick up things at the current location", dopickup }, { '\0', "polyself", "polymorph self", wiz_polyself, IFBURIED | AUTOCOMPLETE | WIZMODECMD }, -#ifdef PORT_DEBUG - { '\0', "portdebug", "wizard port debug command", - wiz_port_debug, IFBURIED | AUTOCOMPLETE | WIZMODECMD }, -#endif { M('p'), "pray", "pray to the gods for help", dopray, IFBURIED | AUTOCOMPLETE }, { C('p'), "prevmsg", "view recent game messages", @@ -5508,6 +5501,15 @@ parse() alt_esc = FALSE; /* readchar() reset */ #endif + if (iflags.debug_fuzzer /* if fuzzing, override '!' and ^Z */ + && (Cmd.commands[foo & 0x0ff] + && (Cmd.commands[foo & 0x0ff]->ef_funct == dosuspend_core +#ifdef SHELL + || Cmd.commands[foo & 0x0ff]->ef_funct == dosh +#endif + ))) + foo = Cmd.spkeys[NHKF_ESC]; + if (foo == Cmd.spkeys[NHKF_ESC]) { /* esc cancels count (TH) */ clear_nhwindow(WIN_MESSAGE); multi = last_multi = 0; @@ -5707,58 +5709,6 @@ dotravel(VOID_ARGS) return 0; } -#ifdef PORT_DEBUG -#if defined(WIN32) && defined(TTY_GRAPHICS) -extern void NDECL(win32con_debug_keystrokes); -extern void NDECL(win32con_handler_info); -#endif - -int -wiz_port_debug() -{ - int n, k; - winid win; - anything any; - int item = 'a'; - int num_menu_selections; - struct menu_selection_struct { - char *menutext; - void NDECL((*fn)); - } menu_selections[] = { -#if defined(WIN32) && defined(TTY_GRAPHICS) - { "test win32 keystrokes (tty only)", win32con_debug_keystrokes }, - { "show keystroke handler information (tty only)", - win32con_handler_info }, -#endif - { (char *) 0, (void NDECL((*))) 0 } /* array terminator */ - }; - - num_menu_selections = SIZE(menu_selections) - 1; - if (num_menu_selections > 0) { - menu_item *pick_list; - - win = create_nhwindow(NHW_MENU); - start_menu(win); - for (k = 0; k < num_menu_selections; ++k) { - any.a_int = k + 1; - add_menu(win, NO_GLYPH, &any, item++, 0, ATR_NONE, - menu_selections[k].menutext, MENU_UNSELECTED); - } - end_menu(win, "Which port debugging feature?"); - n = select_menu(win, PICK_ONE, &pick_list); - destroy_nhwindow(win); - if (n > 0) { - n = pick_list[0].item.a_int - 1; - free((genericptr_t) pick_list); - /* execute the function */ - (*menu_selections[n].fn)(); - } - } else - pline("No port-specific debug capability defined."); - return 0; -} -#endif /*PORT_DEBUG*/ - /* * Parameter validator for generic yes/no function to prevent * the core from sending too long a prompt string to the diff --git a/src/do_wear.c b/src/do_wear.c index 7ab53a79e..8300bd0c2 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do_wear.c $NHDT-Date: 1514072526 2017/12/23 23:42:06 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.100 $ */ +/* NetHack 3.6 do_wear.c $NHDT-Date: 1543745354 2018/12/02 10:09:14 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.103 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1112,13 +1112,7 @@ register struct obj *otmp; You("can see!"); } if (changed) { - /* blindness has just been toggled */ - if (Blind_telepat || Infravision) - see_monsters(); - vision_full_recalc = 1; /* recalc vision limits */ - if (!Blind) - learn_unseen_invent(); - context.botl = 1; + toggle_blindness(); /* potion.c */ } } @@ -1157,13 +1151,7 @@ register struct obj *otmp; } } if (changed) { - /* blindness has just been toggled */ - if (Blind_telepat || Infravision) - see_monsters(); - vision_full_recalc = 1; /* recalc vision limits */ - if (!Blind) - learn_unseen_invent(); - context.botl = 1; + toggle_blindness(); /* potion.c */ } } diff --git a/src/files.c b/src/files.c index bec88904f..3dd137743 100644 --- a/src/files.c +++ b/src/files.c @@ -1279,7 +1279,7 @@ boolean uncomp; int i = 0; int f; #ifdef TTY_GRAPHICS - boolean istty = !strncmpi(windowprocs.name, "tty", 3); + boolean istty = WINDOWPORT("tty"); #endif Strcpy(cfn, filename); diff --git a/src/objnam.c b/src/objnam.c index af74c3bf0..7ed8f33fb 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 objnam.c $NHDT-Date: 1543544340 2018/11/30 02:19:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.226 $ */ +/* NetHack 3.6 objnam.c $NHDT-Date: 1543745355 2018/12/02 10:09:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.227 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1150,15 +1150,16 @@ unsigned doname_flags; if (bimanual(obj)) hand_s = makeplural(hand_s); + /* note: Sting's glow message, if added, will insert text + in front of "(weapon in hand)"'s closing paren */ Sprintf(eos(bp), " (%sweapon in %s)", (obj->otyp == AKLYS) ? "tethered " : "", hand_s); if (warn_obj_cnt && obj == uwep && (EWarn_of_mon & W_WEP) != 0L) { - /* this used to be "(glowing )" when sighted or - "(glowing)" when blind (via feeling warmth), but it - isn't a light source so describe something fainter */ - if (!Blind) - Sprintf(eos(bp), " (%s aura)", glow_color(obj->oartifact)); + if (!Blind) /* we know bp[] ends with ')'; overwrite that */ + Sprintf(eos(bp) - 1, ", %s %s)", + glow_verb(warn_obj_cnt, TRUE), + glow_color(obj->oartifact)); } } } diff --git a/src/potion.c b/src/potion.c index 8985755bb..dc96331e6 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 potion.c $NHDT-Date: 1520797133 2018/03/11 19:38:53 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.144 $ */ +/* NetHack 3.6 potion.c $NHDT-Date: 1543745356 2018/12/02 10:09:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.155 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -306,32 +306,43 @@ boolean talk; set_itimeout(&Blinded, xtime); if (u_could_see ^ can_see_now) { /* one or the other but not both */ - context.botl = TRUE; - vision_full_recalc = 1; /* blindness just got toggled */ - /* this vision recalculation used to be deferred until - moveloop(), but that made it possible for vision - irregularities to occur (cited case was force bolt - hitting adjacent potion of blindness and then a - secret door; hero was blinded by vapors but then - got the message "a door appears in the wall") */ - vision_recalc(0); - if (Blind_telepat || Infravision) - see_monsters(); - - /* avoid either of the sequences - "Sting starts glowing", [become blind], "Sting stops quivering" or - "Sting starts quivering", [regain sight], "Sting stops glowing" - by giving "Sting is quivering" when becoming blind or - "Sting is glowing" when regaining sight so that the eventual - "stops" message matches */ - if (warn_obj_cnt && uwep && (EWarn_of_mon & W_WEP) != 0L) - Sting_effects(-1); - /* update dknown flag for inventory picked up while blind */ - if (can_see_now) - learn_unseen_invent(); + toggle_blindness(); } } +/* blindness has just started or just ended--caller enforces that; + called by Blindf_on(), Blindf_off(), and make_blinded() */ +void +toggle_blindness() +{ + boolean Stinging = (uwep && (EWarn_of_mon & W_WEP) != 0L); + + /* blindness has just been toggled */ + context.botl = TRUE; /* status conditions need update */ + vision_full_recalc = 1; /* vision has changed */ + /* this vision recalculation used to be deferred until moveloop(), + but that made it possible for vision irregularities to occur + (cited case was force bolt hitting an adjacent potion of blindness + and then a secret door; hero was blinded by vapors but then got the + message "a door appears in the wall" because wall spot was IN_SIGHT) */ + vision_recalc(0); + if (Blind_telepat || Infravision || Stinging) + see_monsters(); /* also counts EWarn_of_mon monsters */ + /* + * Avoid either of the sequences + * "Sting starts glowing", [become blind], "Sting stops quivering" or + * "Sting starts quivering", [regain sight], "Sting stops glowing" + * by giving "Sting is quivering" when becoming blind or + * "Sting is glowing" when regaining sight so that the eventual + * "stops" message matches the most recent "Sting is ..." one. + */ + if (Stinging) + Sting_effects(-1); + /* update dknown flag for inventory picked up while blind */ + if (!Blind) + learn_unseen_invent(); +} + boolean make_hallucinated(xtime, talk, mask) long xtime; /* nonzero if this is an attempt to turn on hallucination */ diff --git a/src/restore.c b/src/restore.c index f26379967..25604f10d 100644 --- a/src/restore.c +++ b/src/restore.c @@ -828,7 +828,7 @@ register int fd; #ifdef AMII_GRAPHICS { extern struct window_procs amii_procs; - if (windowprocs.win_init_nhwindows == amii_procs.win_init_nhwindows) { + if (WINDOWPORT("amii") { extern winid WIN_BASE; clear_nhwindow(WIN_BASE); /* hack until there's a hook for this */ } @@ -844,7 +844,7 @@ register int fd; curs(WIN_MAP, 1, 1); dotcnt = 0; dotrow = 2; - if (strncmpi("X11", windowprocs.name, 3)) + if (!WINDOWPORT("X11")) putstr(WIN_MAP, 0, "Restoring:"); #endif restoreprocs.mread_flags = 1; /* return despite error */ @@ -859,7 +859,7 @@ register int fd; dotrow++; dotcnt = 0; } - if (strncmpi("X11", windowprocs.name, 3)) { + if (!WINDOWPORT("X11")) { putstr(WIN_MAP, 0, "."); } mark_synch(); diff --git a/src/save.c b/src/save.c index bca03c49e..095890f05 100644 --- a/src/save.c +++ b/src/save.c @@ -178,7 +178,7 @@ dosave0() dotcnt = 0; dotrow = 2; curs(WIN_MAP, 1, 1); - if (strncmpi("X11", windowprocs.name, 3)) + if (!WINDOWPORT("X11")) putstr(WIN_MAP, 0, "Saving:"); #endif #ifdef MFLOPPY @@ -242,7 +242,7 @@ dosave0() dotrow++; dotcnt = 0; } - if (strncmpi("X11", windowprocs.name, 3)) { + if (!WINDOWPORT("X11")) { putstr(WIN_MAP, 0, "."); } mark_synch(); diff --git a/src/windows.c b/src/windows.c index 9e7ffe5b3..7326dd7a2 100644 --- a/src/windows.c +++ b/src/windows.c @@ -1277,7 +1277,7 @@ winid win UNUSED; STATIC_OVL void dump_add_menu(win, glyph, identifier, ch, gch, attr, str, preselected) winid win UNUSED; -int glyph UNUSED; +int glyph; const anything *identifier UNUSED; char ch; char gch UNUSED; diff --git a/src/zap.c b/src/zap.c index d53468fe3..5a5a67c34 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 zap.c $NHDT-Date: 1542798627 2018/11/21 11:10:27 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.289 $ */ +/* NetHack 3.6 zap.c $NHDT-Date: 1543744276 2018/12/02 09:51:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.299 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -433,7 +433,8 @@ struct obj *otmp; dmg = spell_damage_bonus(dmg); if (resists_drli(mtmp)) { shieldeff(mtmp->mx, mtmp->my); - } else if (!resist(mtmp, otmp->oclass, dmg, NOTELL) && !DEADMONSTER(mtmp)) { + } else if (!resist(mtmp, otmp->oclass, dmg, NOTELL) + && !DEADMONSTER(mtmp)) { mtmp->mhp -= dmg; mtmp->mhpmax -= dmg; /* die if already level 0, regardless of hit points */ @@ -782,7 +783,7 @@ boolean by_hero; if ((mons[montype].mlet == S_EEL && !IS_POOL(levl[x][y].typ)) || (mons[montype].mlet == S_TROLL && uwep && uwep->oartifact == ART_TROLLSBANE)) { - if (by_hero && cansee(x,y)) + if (by_hero && cansee(x, y)) pline("%s twitches feebly.", upstart(corpse_xname(corpse, (const char *) 0, CXN_PFX_THE))); return (struct monst *) 0; @@ -1831,10 +1832,9 @@ struct obj *obj, *otmp; * from its inventory as a result of the change. * If the items fall to the floor, they are not * subject to direct subsequent polymorphing - * themselves on that same zap. This makes it - * consistent with items that remain in the - * monster's inventory. They are not polymorphed - * either. + * themselves on that same zap. This makes it + * consistent with items that remain in the monster's + * inventory. They are not polymorphed either. * UNDEAD_TURNING - When an undead creature gets killed via * undead turning, prevent its corpse from being * immediately revived by the same effect. diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index 20b73f728..8651ae8fe 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -499,12 +499,12 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ #ifdef WIN32 /* - if (!strncmpi(windowprocs.name, "mswin", 5)) + if (WINDOWPORT("mswin")) NHWinMainInit(); else */ #ifdef TTY_GRAPHICS - if (!strncmpi(windowprocs.name, "tty", 3)) { + if (WINDOWPORT("tty")) { iflags.use_background_glyph = FALSE; nttty_open(1); } else { diff --git a/sys/share/pcunix.c b/sys/share/pcunix.c index 22bc4ae4e..bb746ca92 100644 --- a/sys/share/pcunix.c +++ b/sys/share/pcunix.c @@ -198,7 +198,7 @@ getlock() #ifndef SELF_RECOVER if (eraseoldlocks()) { #if defined(WIN32) && defined(TTY_GRAPHICS) - if (!strncmpi(windowprocs.name, "tty", 3)) + if (WINDOWPORT("tty")) clear_screen(); /* display gets fouled up otherwise */ #endif goto gotlock; @@ -212,7 +212,7 @@ getlock() #else /*SELF_RECOVER*/ if (recover_savefile()) { #if defined(WIN32) && defined(TTY_GRAPHICS) - if (!strncmpi(windowprocs.name, "tty", 3)) + if (WINDOWPORT("tty")) clear_screen(); /* display gets fouled up otherwise */ #endif goto gotlock; diff --git a/sys/share/unixtty.c b/sys/share/unixtty.c index 00d473204..39a859e79 100644 --- a/sys/share/unixtty.c +++ b/sys/share/unixtty.c @@ -305,7 +305,7 @@ void intron() /* enable kbd interupts if enabled when game started */ { #ifdef TTY_GRAPHICS /* Ugly hack to keep from changing tty modes for non-tty games -dlc */ - if (!strcmp(windowprocs.name, "tty") && intr_char != nonesuch + if (WINDOWPORT("tty") && intr_char != nonesuch && curttyb2.intr_sym != '\003') { curttyb2.intr_sym = '\003'; setctty(); @@ -317,7 +317,7 @@ void introff() /* disable kbd interrupts if required*/ { #ifdef TTY_GRAPHICS /* Ugly hack to keep from changing tty modes for non-tty games -dlc */ - if (!strcmp(windowprocs.name, "tty") && curttyb2.intr_sym != nonesuch) { + if (WINDOWPORT("tty") && curttyb2.intr_sym != nonesuch) { curttyb2.intr_sym = nonesuch; setctty(); } @@ -345,7 +345,7 @@ void sco_mapon() { #ifdef TTY_GRAPHICS - if (!strcmp(windowprocs.name, "tty") && sco_flag_console) { + if (WINDOWPORT("tty") && sco_flag_console) { if (sco_map_valid != -1) { ioctl(0, LDSMAP, sco_chanmap_buf); } @@ -358,7 +358,7 @@ void sco_mapoff() { #ifdef TTY_GRAPHICS - if (!strcmp(windowprocs.name, "tty") && sco_flag_console) { + if (WINDOWPORT("tty") && sco_flag_console) { sco_map_valid = ioctl(0, LDGMAP, sco_chanmap_buf); if (sco_map_valid != -1) { ioctl(0, LDNMAP, (char *) 0); @@ -379,7 +379,7 @@ void init_sco_cons() { #ifdef TTY_GRAPHICS - if (!strcmp(windowprocs.name, "tty") && sco_flag_console) { + if (WINDOWPORT("tty") && sco_flag_console) { atexit(sco_mapon); sco_mapoff(); load_symset("IBMGraphics", PRIMARY); @@ -409,7 +409,7 @@ void linux_mapon() { #ifdef TTY_GRAPHICS - if (!strcmp(windowprocs.name, "tty") && linux_flag_console) { + if (WINDOWPORT("tty") && linux_flag_console) { write(1, "\033(B", 3); } #endif @@ -419,7 +419,7 @@ void linux_mapoff() { #ifdef TTY_GRAPHICS - if (!strcmp(windowprocs.name, "tty") && linux_flag_console) { + if (WINDOWPORT("tty") && linux_flag_console) { write(1, "\033(U", 3); } #endif @@ -439,7 +439,7 @@ void init_linux_cons() { #ifdef TTY_GRAPHICS - if (!strcmp(windowprocs.name, "tty") && linux_flag_console) { + if (WINDOWPORT("tty") && linux_flag_console) { atexit(linux_mapon); linux_mapoff(); #ifdef TEXTCOLOR diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index f22cea224..4b8e4f6f1 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -73,8 +73,8 @@ DEBUGINFO = Y # PDCurses header (.h) files and PDCURSES_C to the location # of your PDCurses C files. # -ADD_CURSES=Y -PDCURSES_TOP=..\..\pdcurses +#ADD_CURSES=Y +#PDCURSES_TOP=..\..\pdcurses # #============================================================================== # This marks the end of the BUILD DECISIONS section. diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index 5b0fd8bc8..0be1da094 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -216,7 +216,7 @@ VA_DECL(const char *, s) /* error() may get called before tty is initialized */ if (iflags.window_inited) end_screen(); - if (windowprocs.name != NULL && !strncmpi(windowprocs.name, "tty", 3)) { + if (WINDOWPORT("tty")) { buf[0] = '\n'; (void) vsprintf(&buf[1], s, VA_ARGS); Strcat(buf, "\n"); @@ -239,6 +239,11 @@ Delay(int ms) void win32_abort() { + boolean is_tty = FALSE; + +#ifdef TTY_GRAPHICS + is_tty = WINDOWPORT("tty"); +#endif if (wizard) { int c, ci, ct; @@ -248,13 +253,11 @@ win32_abort() msmsg("Execute debug breakpoint wizard?"); while ((ci = nhgetch()) != '\n') { if (ct > 0) { -#ifdef TTY_GRAPHICS - backsp(); /* \b is visible on NT */ -#endif + if (is_tty) + backsp(); /* \b is visible on NT console */ (void) putchar(' '); -#ifdef TTY_GRAPHICS - backsp(); -#endif + if (is_tty) + backsp(); ct = 0; c = 'n'; }