diff --git a/src/allmain.c b/src/allmain.c index aa68aa6a4..962df4c68 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 allmain.c $NHDT-Date: 1445215016 2015/10/19 00:36:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.65 $ */ +/* NetHack 3.6 allmain.c $NHDT-Date: 1446975459 2015/11/08 09:37:39 $ $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -58,8 +58,7 @@ boolean resuming; if (!resuming) { /* new game */ context.rndencode = rnd(9000); - set_wear( - (struct obj *) 0); /* for side-effects of worn starting gear */ + set_wear((struct obj *) 0); /* for side-effects of starting gear */ (void) pickup(1); /* autopickup at initial location */ } else { /* restore old game */ #ifndef WIN32 @@ -516,10 +515,10 @@ display_gamewindows() SanePositions(); #endif -/* - * The mac port is not DEPENDENT on the order of these - * displays, but it looks a lot better this way... - */ + /* + * The mac port is not DEPENDENT on the order of these + * displays, but it looks a lot better this way... + */ #ifndef STATUS_VIA_WINDOWPORT display_nhwindow(WIN_STATUS, FALSE); #endif @@ -569,7 +568,7 @@ newgame() display_file(NEWS, FALSE); #endif load_qtlist(); /* load up the quest text info */ - /* quest_init();*/ /* Now part of role_init() */ + /* quest_init(); -- Now part of role_init() */ mklev(); u_on_upstairs(); diff --git a/src/alloc.c b/src/alloc.c index 30c8e62a1..468cb9f86 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 alloc.c $NHDT-Date: 1432512771 2015/05/25 00:12:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */ +/* NetHack 3.6 alloc.c $NHDT-Date: 1446975460 2015/11/08 09:37:40 $ $NHDT-Branch: master $:$NHDT-Revision: 1.14 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -27,19 +27,20 @@ extern void VDECL(panic, (const char *, ...)) PRINTF_F(1, 2); -long *alloc(lth) register unsigned int lth; +long *alloc(lth) +register unsigned int lth; { #ifdef LINT /* * a ridiculous definition, suppressing - * "possible pointer alignment problem" for (long *) malloc() + * "possible pointer alignment problem" for (long *) malloc() * from lint */ long dummy = ftell(stderr); if (lth) dummy = 0; /* make sure arg is used */ - return (&dummy); + return &dummy; #else register genericptr_t ptr; @@ -48,7 +49,7 @@ long *alloc(lth) register unsigned int lth; if (!ptr) panic("Memory allocation failure; cannot get %u bytes", lth); #endif - return ((long *) ptr); + return (long *) ptr; #endif } diff --git a/src/attrib.c b/src/attrib.c index 17c6b930c..d2dafb4ff 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -1,5 +1,5 @@ -/* NetHack 3.6 attrib.c $NHDT-Date: 1432512774 2015/05/25 00:12:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.46 $ */ -/* Copyright 1988, 1989, 1990, 1992, M. Stephenson */ +/* NetHack 3.6 attrib.c $NHDT-Date: 1446975460 2015/11/08 09:37:40 $ $NHDT-Branch: master $:$NHDT-Revision: 1.49 $ */ +/* Copyright 1988, 1989, 1990, 1992, M. Stephenson */ /* NetHack may be freely redistributed. See license for details. */ /* attribute modification routines. */ @@ -8,11 +8,12 @@ #include /* part of the output on gain or loss of attribute */ -static const char *const plusattr[] = { "strong", "smart", "wise", - "agile", "tough", "charismatic" }, - *const minusattr[] = { "weak", "stupid", - "foolish", "clumsy", - "fragile", "repulsive" }; +static const char + *const plusattr[] = { "strong", "smart", "wise", + "agile", "tough", "charismatic" }, + *const minusattr[] = { "weak", "stupid", + "foolish", "clumsy", + "fragile", "repulsive" }; static const struct innate { schar ulevel; @@ -360,13 +361,13 @@ boolean inc_or_dec; if (abs(AEXE(i)) < AVAL) { /* - * Law of diminishing returns (Part I): + * Law of diminishing returns (Part I): * - * Gain is harder at higher attribute values. - * 79% at "3" --> 0% at "18" - * Loss is even at all levels (50%). + * Gain is harder at higher attribute values. + * 79% at "3" --> 0% at "18" + * Loss is even at all levels (50%). * - * Note: *YES* ACURR is the right one to use. + * Note: *YES* ACURR is the right one to use. */ AEXE(i) += (inc_or_dec) ? (rn2(19) > ACURR(i)) : -rn2(2); debugpline3("%s, %s AEXE = %d", @@ -464,21 +465,21 @@ exerchk() { int i, ax, mod_val, lolim, hilim; - /* Check out the periodic accumulations */ + /* Check out the periodic accumulations */ exerper(); if (moves >= context.next_attrib_check) debugpline1("exerchk: ready to test. multi = %d.", multi); - /* Are we ready for a test? */ + /* Are we ready for a test? */ if (moves >= context.next_attrib_check && !multi) { debugpline0("exerchk: testing."); /* - * Law of diminishing returns (Part II): + * Law of diminishing returns (Part II): * - * The effects of "exercise" and "abuse" wear - * off over time. Even if you *don't* get an - * increase/decrease, you lose some of the - * accumulated effects. + * The effects of "exercise" and "abuse" wear + * off over time. Even if you *don't* get an + * increase/decrease, you lose some of the + * accumulated effects. */ for (i = 0; i < A_MAX; ++i) { ax = AEXE(i); @@ -516,10 +517,10 @@ exerchk() : "???", ax); /* - * Law of diminishing returns (Part III): + * Law of diminishing returns (Part III): * - * You don't *always* gain by exercising. - * [MRS 92/10/28 - Treat Wisdom specially for balance.] + * You don't *always* gain by exercising. + * [MRS 92/10/28 - Treat Wisdom specially for balance.] */ if (rn2(AVAL) > ((i != A_WIS) ? (abs(ax) * 2 / 3) : abs(ax))) goto nextattrib; @@ -971,31 +972,30 @@ int x; register int tmp = (u.abon.a[x] + u.atemp.a[x] + u.acurr.a[x]); if (x == A_STR) { - if (uarmg && uarmg->otyp == GAUNTLETS_OF_POWER) - return (125); + if (tmp >= 125 || (uarmg && uarmg->otyp == GAUNTLETS_OF_POWER)) + return (schar) 125; + else #ifdef WIN32_BUG - else - return (x = ((tmp >= 125) ? 125 : (tmp <= 3) ? 3 : tmp)); + return (x = ((tmp <= 3) ? 3 : tmp)); #else - else - return ((schar)((tmp >= 125) ? 125 : (tmp <= 3) ? 3 : tmp)); + return (schar) ((tmp <= 3) ? 3 : tmp); #endif } else if (x == A_CHA) { if (tmp < 18 && (youmonst.data->mlet == S_NYMPH || u.umonnum == PM_SUCCUBUS || u.umonnum == PM_INCUBUS)) - return 18; + return (schar) 18; } else if (x == A_INT || x == A_WIS) { /* yes, this may raise int/wis if player is sufficiently * stupid. there are lower levels of cognition than "dunce". */ if (uarmh && uarmh->otyp == DUNCE_CAP) - return (6); + return (schar) 6; } #ifdef WIN32_BUG return (x = ((tmp >= 25) ? 25 : (tmp <= 3) ? 3 : tmp)); #else - return ((schar)((tmp >= 25) ? 25 : (tmp <= 3) ? 3 : tmp)); + return (schar) ((tmp >= 25) ? 25 : (tmp <= 3) ? 3 : tmp); #endif } @@ -1007,11 +1007,11 @@ acurrstr() register int str = ACURR(A_STR); if (str <= 18) - return ((schar) str); + return (schar) str; if (str <= 121) - return ((schar)(19 + str / 50)); /* map to 19-21 */ + return (schar) (19 + str / 50); /* map to 19..21 */ else - return ((schar)(str - 100)); + return (schar) (min(str, 125) - 100); /* 22..25 */ } /* when wearing (or taking off) an unID'd item, this routine is used @@ -1043,13 +1043,12 @@ int attrindx; } /* avoid possible problems with alignment overflow, and provide a centralized - * location for any future alignment limits - */ + location for any future alignment limits */ void adjalign(n) -register int n; +int n; { - register int newalign = u.ualign.record + n; + int newalign = u.ualign.record + n; if (n < 0) { if (newalign < u.ualign.record) diff --git a/src/botl.c b/src/botl.c index baa6bdcf7..f58227ad8 100644 --- a/src/botl.c +++ b/src/botl.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 botl.c $NHDT-Date: 1435002677 2015/06/22 19:51:17 $ $NHDT-Branch: master $:$NHDT-Revision: 1.64 $ */ +/* NetHack 3.6 botl.c $NHDT-Date: 1446975461 2015/11/08 09:37:41 $ $NHDT-Branch: master $:$NHDT-Revision: 1.67 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -24,6 +24,7 @@ bot1() char newbot1[MAXCO]; register char *nb; register int i, j; + Strcpy(newbot1, plname); if ('a' <= newbot1[0] && newbot1[0] <= 'z') newbot1[0] += 'A' - 'a'; @@ -73,6 +74,7 @@ bot1() curs(WIN_STATUS, 1, 0); putstr(WIN_STATUS, 0, newbot1); } + STATIC_OVL void bot2() { @@ -152,7 +154,7 @@ int rank_to_xlev(rank) int rank; { - return (rank <= 0) ? 1 : (rank <= 8) ? ((rank * 4) - 2) : 30; + return (rank <= 0) ? 1 : (rank <= 8) ? ((rank * 4) - 2) : 30; } #endif @@ -175,23 +177,23 @@ boolean female; /* Find the rank */ for (i = xlev_to_rank((int) lev); i >= 0; i--) { if (female && role->rank[i].f) - return (role->rank[i].f); + return role->rank[i].f; if (role->rank[i].m) - return (role->rank[i].m); + return role->rank[i].m; } /* Try the role name, instead */ if (female && role->name.f) - return (role->name.f); + return role->name.f; else if (role->name.m) - return (role->name.m); - return ("Player"); + return role->name.m; + return "Player"; } STATIC_OVL const char * rank() { - return (rank_of(u.ulevel, Role_switch, flags.female)); + return rank_of(u.ulevel, Role_switch, flags.female); } int @@ -220,8 +222,8 @@ int *rank_indx, *title_length; *rank_indx = j; if (title_length) *title_length = strlen(roles[i].rank[j].f); - return ((roles[i].femalenum != NON_PM) ? roles[i].femalenum - : roles[i].malenum); + return (roles[i].femalenum != NON_PM) ? roles[i].femalenum + : roles[i].malenum; } } return NON_PM; @@ -251,14 +253,13 @@ botl_score() utotal = money_cnt(invent) + hidden_gold(); if ((utotal -= u.umoney0) < 0L) utotal = 0L; - utotal += - u.urexp + (50 * (deepest - 1)) - + (deepest > 30 ? 10000 : deepest > 20 ? 1000 * (deepest - 20) : 0); + utotal += u.urexp + (50 * (deepest - 1)) + + (deepest > 30 ? 10000 : deepest > 20 ? 1000 * (deepest - 20) : 0); if (utotal < u.urexp) utotal = LONG_MAX; /* wrap around */ return utotal; } -#endif +#endif /* SCORE_ON_BOTL */ /* provide the name of the current level for display by various ports */ int @@ -267,7 +268,7 @@ char *buf; { int ret = 1; - /* TODO: Add in dungeon name */ + /* TODO: Add in dungeon name */ if (Is_knox(&u.uz)) Sprintf(buf, "%s ", dungeons[u.uz.dnum].dname); else if (In_quest(&u.uz)) @@ -304,35 +305,37 @@ STATIC_OVL int FDECL(percentage, (struct istat_s *, struct istat_s *)); STATIC_OVL int FDECL(compare_blstats, (struct istat_s *, struct istat_s *)); #ifdef STATUS_HILITES -STATIC_DCL boolean FDECL(assign_hilite, (char *, char *, char *, char *, BOOLEAN_P)); +STATIC_DCL boolean FDECL(assign_hilite, (char *, char *, char *, char *, + BOOLEAN_P)); STATIC_DCL const char *FDECL(clridx_to_s, (char *, int)); #endif /* If entries are added to this, botl.h will require updating too */ STATIC_DCL struct istat_s initblstats[MAXBLSTATS] = { - { 0L, ANY_STR, {(genericptr_t)0L}, (char *)0, 80, 0, BL_TITLE}, - { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_STR}, - { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_DX}, - { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_CO}, - { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_IN}, - { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_WI}, - { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_CH}, - { 0L, ANY_STR, {(genericptr_t)0L}, (char *)0, 40, 0, BL_ALIGN}, - { 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 20, 0, BL_SCORE}, - { 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 20, 0, BL_CAP}, - { 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 30, 0, BL_GOLD}, - { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, BL_ENEMAX, BL_ENE}, - { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_ENEMAX}, - { 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 10, 0, BL_XP}, - { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_AC}, - { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_HD}, - { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 20, 0, BL_TIME}, - { 0L, ANY_UINT, {(genericptr_t)0L}, (char *)0, 40, 0, BL_HUNGER}, - { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, BL_HPMAX, BL_HP}, - { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_HPMAX}, - { 0L, ANY_STR, {(genericptr_t)0L}, (char *)0, 80, 0, BL_LEVELDESC}, - { 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 20, 0, BL_EXP}, - { 0L, ANY_MASK32,{(genericptr_t)0L},(char *)0, 0, 0, BL_CONDITION} + { 0L, ANY_STR, { (genericptr_t) 0 }, (char *) 0, 80, 0, BL_TITLE}, + { 0L, ANY_INT, { (genericptr_t) 0 }, (char *) 0, 10, 0, BL_STR}, + { 0L, ANY_INT, { (genericptr_t) 0 }, (char *) 0, 10, 0, BL_DX}, + { 0L, ANY_INT, { (genericptr_t) 0 }, (char *) 0, 10, 0, BL_CO}, + { 0L, ANY_INT, { (genericptr_t) 0 }, (char *) 0, 10, 0, BL_IN}, + { 0L, ANY_INT, { (genericptr_t) 0 }, (char *) 0, 10, 0, BL_WI}, + { 0L, ANY_INT, { (genericptr_t) 0 }, (char *) 0, 10, 0, BL_CH}, + { 0L, ANY_STR, { (genericptr_t) 0 }, (char *) 0, 40, 0, BL_ALIGN}, + { 0L, ANY_LONG, { (genericptr_t) 0 }, (char *) 0, 20, 0, BL_SCORE}, + { 0L, ANY_LONG, { (genericptr_t) 0 }, (char *) 0, 20, 0, BL_CAP}, + { 0L, ANY_LONG, { (genericptr_t) 0 }, (char *) 0, 30, 0, BL_GOLD}, + { 0L, ANY_INT, { (genericptr_t) 0 }, (char *) 0, 10, BL_ENEMAX, BL_ENE}, + { 0L, ANY_INT, { (genericptr_t) 0 }, (char *) 0, 10, 0, BL_ENEMAX}, + { 0L, ANY_LONG, { (genericptr_t) 0 }, (char *) 0, 10, 0, BL_XP}, + { 0L, ANY_INT, { (genericptr_t) 0 }, (char *) 0, 10, 0, BL_AC}, + { 0L, ANY_INT, { (genericptr_t) 0 }, (char *) 0, 10, 0, BL_HD}, + { 0L, ANY_INT, { (genericptr_t) 0 }, (char *) 0, 20, 0, BL_TIME}, + { 0L, ANY_UINT, { (genericptr_t) 0 }, (char *) 0, 40, 0, BL_HUNGER}, + { 0L, ANY_INT, { (genericptr_t) 0 }, (char *) 0, 10, BL_HPMAX, BL_HP}, + { 0L, ANY_INT, { (genericptr_t) 0 }, (char *) 0, 10, 0, BL_HPMAX}, + { 0L, ANY_STR, { (genericptr_t) 0 }, (char *) 0, 80, 0, BL_LEVELDESC}, + { 0L, ANY_LONG, { (genericptr_t) 0 }, (char *) 0, 20, 0, BL_EXP}, + { 0L, ANY_MASK32, + { (genericptr_t) 0 }, (char *) 0, 0, 0, BL_CONDITION} }; static struct fieldid_t { @@ -576,7 +579,8 @@ bot() for (i = 0; i < MAXBLSTATS; i++) { if (((i == BL_SCORE) && !flags.showscore) || ((i == BL_EXP) && !flags.showexp) - || ((i == BL_TIME) && !flags.time) || ((i == BL_HD) && !Upolyd) + || ((i == BL_TIME) && !flags.time) + || ((i == BL_HD) && !Upolyd) || ((i == BL_XP || i == BL_EXP) && Upolyd)) continue; anytype = blstats[idx][i].anytype; @@ -685,7 +689,7 @@ boolean fieldfmt = " S:%s"; fieldname = "score"; status_enablefield(fld, fieldname, fieldfmt, - (!flags.showscore) ? FALSE : TRUE); + (!flags.showscore) ? FALSE : TRUE); break; case BL_CAP: fieldfmt = " %s"; @@ -764,7 +768,7 @@ boolean case BL_FLUSH: default: break; - } + } } update_all = TRUE; } @@ -1134,7 +1138,7 @@ boolean from_configfile; threshold.a_void = 0; /* Example: - * hilite_status: hitpoints/10%/red/normal + * hilite_status: hitpoints/10%/red/normal */ /* field name to statusfield */ @@ -1505,11 +1509,12 @@ status_hilite_menu() char prompt[QBUFSZ]; /* j == 0 below, j == 1 above */ menu_item *pick2 = (menu_item *) 0; + Sprintf(prompt, "Display how when %s?", j ? above : below); tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin); for (k = -3; k < CLR_MAX; ++k) { - /* if (k == -1) continue; */ + /* if (k == -1) continue; */ any = zeroany; any.a_int = (k >= 0) ? k + 1 : k; if (k > 0) diff --git a/src/cmd.c b/src/cmd.c index 75c23da02..17500699c 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1446369464 2015/11/01 09:17:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.205 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1446975462 2015/11/08 09:37:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.206 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -145,14 +145,14 @@ STATIC_PTR int NDECL(wiz_migrate_mons); #endif STATIC_DCL int FDECL(size_monst, (struct monst *)); STATIC_DCL int FDECL(size_obj, (struct obj *)); -STATIC_DCL void FDECL(count_obj, - (struct obj *, long *, long *, BOOLEAN_P, BOOLEAN_P)); -STATIC_DCL void FDECL(obj_chain, - (winid, const char *, struct obj *, long *, long *)); -STATIC_DCL void FDECL(mon_invent_chain, - (winid, const char *, struct monst *, long *, long *)); -STATIC_DCL void FDECL(mon_chain, - (winid, const char *, struct monst *, long *, long *)); +STATIC_DCL void FDECL(count_obj, (struct obj *, long *, long *, + BOOLEAN_P, BOOLEAN_P)); +STATIC_DCL void FDECL(obj_chain, (winid, const char *, struct obj *, + long *, long *)); +STATIC_DCL void FDECL(mon_invent_chain, (winid, const char *, struct monst *, + long *, long *)); +STATIC_DCL void FDECL(mon_chain, (winid, const char *, struct monst *, + long *, long *)); STATIC_DCL void FDECL(contained, (winid, const char *, long *, long *)); STATIC_PTR int NDECL(wiz_show_stats); STATIC_DCL boolean FDECL(accept_menu_prefix, (int NDECL((*)))); @@ -269,13 +269,13 @@ popch() } char -pgetchar() -{ /* courtesy of aeb@cwi.nl */ +pgetchar() /* courtesy of aeb@cwi.nl */ +{ register int ch; if (!(ch = popch())) ch = nhgetch(); - return ((char) ch); + return (char) ch; } /* A ch == 0 resets the pushq */ @@ -306,8 +306,9 @@ char ch; return; } +/* here after # - now read a full-word command */ STATIC_PTR int -doextcmd(VOID_ARGS) /* here after # - now read a full-word command */ +doextcmd(VOID_ARGS) { int idx, retval; int NDECL((*func)); @@ -361,9 +362,11 @@ doextlist(VOID_ARGS) * controlled via runtime option 'extmenu'. * ``# ?'' is counted towards the limit of the number of commands, * so we actually support MAX_EXT_CMD-1 "real" extended commands. + * + * Here after # - now show pick-list of possible commands. */ int -extcmd_via_menu() /* here after # - now show pick-list of possible commands */ +extcmd_via_menu() { const struct ext_func_tab *efp; menu_item *pick_list = (menu_item *) 0; @@ -1169,8 +1172,10 @@ doterrain(VOID_ARGS) * n == 2: another entry was explicitly chosen, so skip preselected one. */ which = (n < 0) ? -1 : (n == 0) ? 1 : sel[0].item.a_int; - if (n > 1 && which == 1) which = sel[1].item.a_int; - if (n > 0) free((genericptr_t)sel); + if (n > 1 && which == 1) + which = sel[1].item.a_int; + if (n > 0) + free((genericptr_t) sel); switch (which) { case 1: reveal_terrain(0, 0); break; /* known map */ @@ -2367,7 +2372,7 @@ minimal_enlightenment() genidx = is_neuter(youmonst.data) ? 2 : flags.female; Sprintf(buf, fmtstr, "gender", genders[genidx].adj); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); - if (Upolyd && (int)u.mfemale != genidx) { + if (Upolyd && (int) u.mfemale != genidx) { Sprintf(buf, fmtstr, "gender (base)", genders[u.mfemale].adj); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); } diff --git a/src/decl.c b/src/decl.c index 7e4f95f6d..944dbe368 100644 --- a/src/decl.c +++ b/src/decl.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 decl.c $NHDT-Date: 1432512771 2015/05/25 00:12:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.60 $ */ +/* NetHack 3.6 decl.c $NHDT-Date: 1446975463 2015/11/08 09:37:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -33,8 +33,8 @@ int otg_temp; /* used by object_to_glyph() [otg] */ NEARDATA int in_doagain = 0; /* - * The following structure will be initialized at startup time with - * the level numbers of some "important" things in the game. + * The following structure will be initialized at startup time with + * the level numbers of some "important" things in the game. */ struct dgn_topology dungeon_topology = { DUMMY }; @@ -156,9 +156,10 @@ NEARDATA struct obj *ublindf = (struct obj *) 0, *uchain = (struct obj *) 0, *uball = (struct obj *) 0; /* some objects need special handling during destruction or placement */ -NEARDATA struct obj *current_wand = 0, /* wand currently zapped/applied */ - *thrownobj = 0, /* object in flight due to throwing */ - *kickedobj = 0; /* object in flight due to kicking */ +NEARDATA struct obj + *current_wand = 0, /* wand currently zapped/applied */ + *thrownobj = 0, /* object in flight due to throwing */ + *kickedobj = 0; /* object in flight due to kicking */ #ifdef TEXTCOLOR /* @@ -328,7 +329,7 @@ NEARDATA struct savefile_info sfrestinfo, sfsaveinfo = { #endif }; -struct plinemsg_type *plinemsg_types = NULL; +struct plinemsg_type *plinemsg_types = (struct plinemsg_type *) 0; #ifdef PANICTRACE char *ARGV0; diff --git a/src/dlb.c b/src/dlb.c index 2bf4aeff8..a0b675246 100644 --- a/src/dlb.c +++ b/src/dlb.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dlb.c $NHDT-Date: 1432512767 2015/05/25 00:12:47 $ $NHDT-Branch: master $:$NHDT-Revision: 1.14 $ */ +/* NetHack 3.6 dlb.c $NHDT-Date: 1446975464 2015/11/08 09:37:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.15 $ */ /* Copyright (c) Kenneth Lorber, Bethesda, Maryland, 1993. */ /* NetHack may be freely redistributed. See license for details. */ @@ -93,23 +93,23 @@ extern char *FDECL(eos, (char *)); * Library file structure: * * HEADER: - * %3ld library FORMAT revision (currently rev 1) - * %1c space - * %8ld # of files in archive (includes 1 for directory) - * %1c space - * %8ld size of allocation for string space for directory names - * %1c space - * %8ld library offset - sanity check - lseek target for start of first file - * %1c space - * %8ld size - sanity check - byte size of complete archive file + * %3ld library FORMAT revision (currently rev 1) + * %1c space + * %8ld # of files in archive (includes 1 for directory) + * %1c space + * %8ld size of allocation for string space for directory names + * %1c space + * %8ld library offset - sanity check - lseek target for start of first file + * %1c space + * %8ld size - sanity check - byte size of complete archive file * * followed by one DIRECTORY entry for each file in the archive, including * the directory itself: - * %1c handling information (compression, etc.) Always ' ' in rev 1. - * %s file name - * %1c space - * %8ld offset in archive file of start of this file - * %c newline + * %1c handling information (compression, etc.) Always ' ' in rev 1. + * %s file name + * %1c space + * %8ld offset in archive file of start of this file + * %c newline * * followed by the contents of the files */ diff --git a/src/do.c b/src/do.c index f192c0a31..2081016a4 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do.c $NHDT-Date: 1437877173 2015/07/26 02:19:33 $ $NHDT-Branch: master $:$NHDT-Revision: 1.147 $ */ +/* NetHack 3.6 do.c $NHDT-Date: 1446975464 2015/11/08 09:37:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.149 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -223,7 +223,7 @@ const char *verb; * obj to null. */ (void) obj_meld(&obj, &otmp); } - return (obj == NULL); + return (boolean) (obj == NULL); } return FALSE; } @@ -265,8 +265,8 @@ register struct obj *obj; docall(obj); } -/** Transforms the sink at the player's position into - * a fountain, throne, altar or grave. */ +/* Transforms the sink at the player's position into + a fountain, throne, altar or grave. */ STATIC_DCL void polymorph_sink() { @@ -299,8 +299,8 @@ polymorph_sink() newsym(u.ux, u.uy); } -/** Teleports the sink at the player's position. - * @return TRUE if sink teleported */ +/* Teleports the sink at the player's position; + return True if sink teleported. */ STATIC_DCL boolean teleport_sink() { @@ -308,14 +308,16 @@ teleport_sink() int cnt = 0; struct trap *trp; struct engr *eng; + do { cx = rnd(COLNO - 1); cy = rn2(ROWNO); trp = t_at(cx, cy); eng = engr_at(cx, cy); } while ((levl[cx][cy].typ != ROOM || trp || eng || cansee(cx, cy)) - && (cnt++ < 200)); - if ((levl[cx][cy].typ == ROOM) && !trp && !eng) { + && cnt++ < 200); + + if (levl[cx][cy].typ == ROOM && !trp && !eng) { /* create sink at new position */ levl[cx][cy].typ = SINK; levl[cx][cy].looted = levl[u.ux][u.uy].looted; @@ -468,6 +470,7 @@ register struct obj *obj; trycall(obj); else if (!nosink) You_hear("the ring bouncing down the drainpipe."); + if (!rn2(20) && !nosink) { pline_The("sink backs up, leaving %s.", doname(obj)); obj->in_use = FALSE; @@ -485,7 +488,7 @@ const char *word; if (obj->owornmask & (W_ARMOR | W_ACCESSORY)) { if (*word) Norep("You cannot %s %s you are wearing.", word, something); - return (FALSE); + return FALSE; } if (obj->otyp == LOADSTONE && obj->cursed) { /* getobj() kludge sets corpsenm to user's specified count @@ -500,19 +503,19 @@ const char *word; } obj->corpsenm = 0; /* reset */ obj->bknown = 1; - return (FALSE); + return FALSE; } if (obj->otyp == LEASH && obj->leashmon != 0) { if (*word) pline_The("leash is tied around your %s.", body_part(HAND)); - return (FALSE); + return FALSE; } if (obj->owornmask & W_SADDLE) { if (*word) You("cannot %s %s you are sitting on.", word, something); - return (FALSE); + return FALSE; } - return (TRUE); + return TRUE; } STATIC_PTR int @@ -520,13 +523,13 @@ drop(obj) register struct obj *obj; { if (!obj) - return (0); + return 0; if (!canletgo(obj, "drop")) - return (0); + return 0; if (obj == uwep) { if (welded(uwep)) { weldmsg(obj); - return (0); + return 0; } setuwep((struct obj *) 0); } @@ -551,7 +554,7 @@ register struct obj *obj; if ((obj->oclass == RING_CLASS || obj->otyp == MEAT_RING) && IS_SINK(levl[u.ux][u.uy].typ)) { dosinkring(obj); - return (1); + return 1; } if (!can_reach_floor(TRUE)) { /* we might be levitating due to #invoke Heart of Ahriman; @@ -570,13 +573,13 @@ register struct obj *obj; hitfloor(obj); if (levhack) float_down(I_SPECIAL | TIMEOUT, W_ARTI | W_ART); - return (1); + return 1; } if (!IS_ALTAR(levl[u.ux][u.uy].typ) && flags.verbose) You("drop %s.", doname(obj)); } dropx(obj); - return (1); + return 1; } /* dropx - take dropped item out of inventory; @@ -776,10 +779,10 @@ int retry; * Dropping a burning potion of oil while levitating can cause * an explosion which might destroy some of hero's inventory, * so the old code - * for (otmp = invent; otmp; otmp = otmp2) { - * otmp2 = otmp->nobj; - * n_dropped += drop(otmp); - * } + * for (otmp = invent; otmp; otmp = otmp2) { + * otmp2 = otmp->nobj; + * n_dropped += drop(otmp); + * } * was unreliable and could lead to an "object lost" panic. * * Use the bypass bit to mark items already processed (hence @@ -844,6 +847,7 @@ drop_done: /* on a ladder, used in goto_level */ static NEARDATA boolean at_ladder = FALSE; +/* the '>' command */ int dodown() { @@ -900,20 +904,20 @@ dodown() floating_above(stairs_down ? "stairs" : ladder_down ? "ladder" : surface(u.ux, u.uy)); - return (0); /* didn't move */ + return 0; /* didn't move */ } if (!stairs_down && !ladder_down) { trap = t_at(u.ux, u.uy); if (trap && uteetering_at_seen_pit(trap)) { dotrap(trap, TOOKPLUNGE); - return (1); + return 1; } else if (!trap || (trap->ttyp != TRAPDOOR && trap->ttyp != HOLE) || !Can_fall_thru(&u.uz) || !trap->tseen) { if (flags.autodig && !context.nopick && uwep && is_pick(uwep)) { return use_pick_axe2(uwep); } else { You_cant("go down here."); - return (0); + return 0; } } } @@ -922,13 +926,13 @@ dodown() !u.uswallow ? "being held" : is_animal(u.ustuck->data) ? "swallowed" : "engulfed"); - return (1); + return 1; } if (on_level(&valley_level, &u.uz) && !u.uevent.gehennom_entered) { You("are standing at the gate to Gehennom."); pline("Unspeakable cruelty and harm lurk down there."); if (yn("Are you sure you want to enter?") != 'y') - return (0); + return 0; else pline("So be it."); u.uevent.gehennom_entered = 1; /* don't ask again */ @@ -936,7 +940,7 @@ dodown() if (!next_to_u()) { You("are held back by your pet!"); - return (0); + return 0; } if (trap) @@ -946,13 +950,14 @@ dodown() if (trap && Is_stronghold(&u.uz)) { goto_hell(FALSE, TRUE); } else { - at_ladder = (boolean)(levl[u.ux][u.uy].typ == LADDER); + at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER); next_level(!trap); at_ladder = FALSE; } - return (1); + return 1; } +/* the '<' command */ int doup() { @@ -970,36 +975,36 @@ doup() && (!sstairs.sx || u.ux != sstairs.sx || u.uy != sstairs.sy || !sstairs.up)) { You_cant("go up here."); - return (0); + return 0; } if (stucksteed(TRUE)) { - return (0); + return 0; } if (u.ustuck) { You("are %s, and cannot go up.", !u.uswallow ? "being held" : is_animal(u.ustuck->data) ? "swallowed" : "engulfed"); - return (1); + return 1; } if (near_capacity() > SLT_ENCUMBER) { /* No levitation check; inv_weight() already allows for it */ Your("load is too heavy to climb the %s.", levl[u.ux][u.uy].typ == STAIRS ? "stairs" : "ladder"); - return (1); + return 1; } if (ledger_no(&u.uz) == 1) { if (yn("Beware, there will be no return! Still climb?") != 'y') - return (0); + return 0; } if (!next_to_u()) { You("are held back by your pet!"); - return (0); + return 0; } - at_ladder = (boolean)(levl[u.ux][u.uy].typ == LADDER); + at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER); prev_level(TRUE); at_ladder = FALSE; - return (1); + return 1; } d_level save_dlevel = { 0, 0 }; @@ -1109,12 +1114,12 @@ boolean at_stairs, falling, portal; * due to overlooking the effect of the call to assign_rnd_lvl().) * * Odds for making it to the next level up, or of being sent down: - * "up" L N C - * +1 75.0 75.0 75.0 - * 0 6.25 8.33 12.5 - * -1 11.46 12.50 12.5 - * -2 5.21 4.17 0.0 - * -3 2.08 0.0 0.0 + * "up" L N C + * +1 75.0 75.0 75.0 + * 0 6.25 8.33 12.5 + * -1 11.46 12.50 12.5 + * -2 5.21 4.17 0.0 + * -3 2.08 0.0 0.0 */ if (Inhell && up && u.uhave.amulet && !newdungeon && !portal && (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz) - 3)) { @@ -1521,8 +1526,8 @@ final_level() gain_guardian_angel(); } -static char *dfr_pre_msg = 0, /* pline() before level change */ - *dfr_post_msg = 0; /* pline() after level change */ +static char *dfr_pre_msg = 0, /* pline() before level change */ + *dfr_post_msg = 0; /* pline() after level change */ /* change levels at the end of this turn, after monsters finish moving */ void @@ -1728,7 +1733,7 @@ long timeout UNUSED; int donull() { - return (1); /* Do nothing, but let other things happen */ + return 1; /* Do nothing, but let other things happen */ } STATIC_PTR int @@ -1749,12 +1754,12 @@ wipeoff(VOID_ARGS) Blinded = 1; make_blinded(0L, TRUE); } - return (0); + return 0; } else if (!u.ucreamed) { Your("%s feels clean now.", body_part(FACE)); - return (0); + return 0; } - return (1); /* still busy */ + return 1; /* still busy */ } int @@ -1768,10 +1773,10 @@ dowipe() /* Not totally correct; what if they change back after now * but before they're finished wiping? */ - return (1); + return 1; } Your("%s is already clean.", body_part(FACE)); - return (1); + return 1; } void diff --git a/src/dothrow.c b/src/dothrow.c index 7336451ec..7c83a6247 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dothrow.c $NHDT-Date: 1445301122 2015/10/20 00:32:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.111 $ */ +/* NetHack 3.6 dothrow.c $NHDT-Date: 1446975465 2015/11/08 09:37:45 $ $NHDT-Branch: master $:$NHDT-Revision: 1.113 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -12,8 +12,8 @@ STATIC_DCL void NDECL(autoquiver); STATIC_DCL int FDECL(gem_accept, (struct monst *, struct obj *)); STATIC_DCL void FDECL(tmiss, (struct obj *, struct monst *, BOOLEAN_P)); STATIC_DCL int FDECL(throw_gold, (struct obj *)); -STATIC_DCL void FDECL(check_shop_obj, - (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P)); +STATIC_DCL void FDECL(check_shop_obj, (struct obj *, XCHAR_P, XCHAR_P, + BOOLEAN_P)); STATIC_DCL void FDECL(breakmsg, (struct obj *, BOOLEAN_P)); STATIC_DCL boolean FDECL(toss_up, (struct obj *, BOOLEAN_P)); STATIC_DCL boolean FDECL(throwing_weapon, (struct obj *)); @@ -66,22 +66,22 @@ int shotlimit; * possibly using a sling. */ if (obj->oclass == COIN_CLASS && obj != uquiver) - return (throw_gold(obj)); + return throw_gold(obj); if (!canletgo(obj, "throw")) - return (0); + return 0; if (obj->oartifact == ART_MJOLLNIR && obj != uwep) { pline("%s must be wielded before it can be thrown.", The(xname(obj))); - return (0); + return 0; } if ((obj->oartifact == ART_MJOLLNIR && ACURR(A_STR) < STR19(25)) || (obj->otyp == BOULDER && !throws_rocks(youmonst.data))) { pline("It's too heavy."); - return (1); + return 1; } if (!u.dx && !u.dy && !u.dz) { You("cannot throw an object at yourself."); - return (0); + return 0; } u_wipe_engr(2); if (!uarmg && obj->otyp == CORPSE && touch_petrifies(&mons[obj->corpsenm]) @@ -516,12 +516,12 @@ genericptr_t arg; * your movements at the time. * * Possible additions/changes: - * o really attack monster if we hit one - * o set stunned if we hit a wall or door - * o reset nomul when we stop - * o creepy feeling if pass through monster (if ever implemented...) - * o bounce off walls - * o let jumps go over boulders + * o really attack monster if we hit one + * o set stunned if we hit a wall or door + * o reset nomul when we stop + * o creepy feeling if pass through monster (if ever implemented...) + * o bounce off walls + * o let jumps go over boulders */ boolean hurtle_step(arg, x, y) @@ -1449,7 +1449,7 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */ } return 1; /* caller doesn't need to place it */ } - return (0); + return 0; } if (obj->oclass == WEAPON_CLASS || is_weptool(obj) @@ -1675,7 +1675,7 @@ nopick: pline1(buf); if (!tele_restrict(mon)) (void) rloc(mon, TRUE); - return (ret); + return ret; } /* @@ -1927,7 +1927,7 @@ struct obj *obj; if (!u.dx && !u.dy && !u.dz) { You("cannot throw gold at yourself."); - return (0); + return 0; } freeinv(obj); if (u.uswallow) { @@ -1935,7 +1935,7 @@ struct obj *obj; : "%s into %s.", "The money disappears", mon_nam(u.ustuck)); add_to_minv(u.ustuck, obj); - return (1); + return 1; } if (u.dz) { @@ -1977,7 +1977,7 @@ struct obj *obj; } if (flooreffects(obj, bhitpos.x, bhitpos.y, "fall")) - return (1); + return 1; if (u.dz > 0) pline_The("gold hits the %s.", surface(bhitpos.x, bhitpos.y)); place_object(obj, bhitpos.x, bhitpos.y); @@ -1985,7 +1985,7 @@ struct obj *obj; sellobj(obj, bhitpos.x, bhitpos.y); stackobj(obj); newsym(bhitpos.x, bhitpos.y); - return (1); + return 1; } /*dothrow.c*/ diff --git a/src/drawing.c b/src/drawing.c index 66619514b..515872a2a 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -1,5 +1,5 @@ -/* NetHack 3.6 drawing.c $NHDT-Date: 1432512765 2015/05/25 00:12:45 $ $NHDT-Branch: master $:$NHDT-Revision: 1.45 $ */ -/* Copyright (c) NetHack Development Team 1992. */ +/* NetHack 3.6 drawing.c $NHDT-Date: 1446975466 2015/11/08 09:37:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.48 $ */ +/* Copyright (c) NetHack Development Team 1992. */ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" @@ -120,142 +120,140 @@ const struct class_sym def_monsyms[MAXMCLASSES] = { }; const struct symdef def_warnsyms[WARNCOUNT] = { - { '0', "unknown creature causing you worry", - C(CLR_WHITE) }, /* white warning */ - { '1', "unknown creature causing you concern", - C(CLR_RED) }, /* pink warning */ - { '2', "unknown creature causing you anxiety", - C(CLR_RED) }, /* red warning */ - { '3', "unknown creature causing you disquiet", - C(CLR_RED) }, /* ruby warning */ - { '4', "unknown creature causing you alarm", - C(CLR_MAGENTA) }, /* purple warning */ - { '5', "unknown creature causing you dread", - C(CLR_BRIGHT_MAGENTA) } /* black warning */ + /* white warning */ + { '0', "unknown creature causing you worry", C(CLR_WHITE) }, + /* pink warning */ + { '1', "unknown creature causing you concern", C(CLR_RED) }, + /* red warning */ + { '2', "unknown creature causing you anxiety", C(CLR_RED) }, + /* ruby warning */ + { '3', "unknown creature causing you disquiet", C(CLR_RED) }, + /* purple warning */ + { '4', "unknown creature causing you alarm", C(CLR_MAGENTA) }, + /* black warning */ + { '5', "unknown creature causing you dread", C(CLR_BRIGHT_MAGENTA) }, }; /* * Default screen symbols with explanations and colors. */ const struct symdef defsyms[MAXPCHARS] = { - /* 0*/ { ' ', "dark part of a room", C(NO_COLOR) }, /* stone */ - { '|', "wall", C(CLR_GRAY) }, /* vwall */ - { '-', "wall", C(CLR_GRAY) }, /* hwall */ - { '-', "wall", C(CLR_GRAY) }, /* tlcorn */ - { '-', "wall", C(CLR_GRAY) }, /* trcorn */ - { '-', "wall", C(CLR_GRAY) }, /* blcorn */ - { '-', "wall", C(CLR_GRAY) }, /* brcorn */ - { '-', "wall", C(CLR_GRAY) }, /* crwall */ - { '-', "wall", C(CLR_GRAY) }, /* tuwall */ - { '-', "wall", C(CLR_GRAY) }, /* tdwall */ - /*10*/ { '|', "wall", C(CLR_GRAY) }, /* tlwall */ - { '|', "wall", C(CLR_GRAY) }, /* trwall */ - { '.', "doorway", C(CLR_GRAY) }, /* ndoor */ - { '-', "open door", C(CLR_BROWN) }, /* vodoor */ - { '|', "open door", C(CLR_BROWN) }, /* hodoor */ - { '+', "closed door", C(CLR_BROWN) }, /* vcdoor */ - { '+', "closed door", C(CLR_BROWN) }, /* hcdoor */ - { '#', "iron bars", C(HI_METAL) }, /* bars */ - { '#', "tree", C(CLR_GREEN) }, /* tree */ - { '.', "floor of a room", C(CLR_GRAY) }, /* room */ - /*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 */ - { '<', "ladder up", C(CLR_BROWN) }, /* upladder */ - { '>', "ladder down", C(CLR_BROWN) }, /* dnladder */ - { '_', "altar", C(CLR_GRAY) }, /* altar */ - { '|', "grave", C(CLR_GRAY) }, /* grave */ - { '\\', "opulent throne", C(HI_GOLD) }, /* throne */ - /*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 */ - { '.', "lowered drawbridge", C(CLR_BROWN) }, /* vodbridge */ - { '.', "lowered drawbridge", C(CLR_BROWN) }, /* hodbridge */ - { '#', "raised drawbridge", C(CLR_BROWN) }, /* vcdbridge */ - { '#', "raised drawbridge", C(CLR_BROWN) }, /* hcdbridge */ - { ' ', "air", C(CLR_CYAN) }, /* open air */ - /*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 */ - { '^', "squeaky board", C(CLR_BROWN) }, /* trap */ - { '^', "bear trap", C(HI_METAL) }, /* trap */ - { '^', "land mine", C(CLR_RED) }, /* trap */ - { '^', "rolling boulder trap", C(CLR_GRAY) }, /* trap */ - { '^', "sleeping gas trap", C(HI_ZAP) }, /* 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 */ - { '^', "trap door", C(CLR_BROWN) }, /* trap */ - { '^', "teleportation trap", C(CLR_MAGENTA) }, /* trap */ - { '^', "level teleporter", C(CLR_MAGENTA) }, /* trap */ - { '^', "magic portal", C(CLR_BRIGHT_MAGENTA) }, /* trap */ - { '"', "web", C(CLR_GRAY) }, /* web */ - /*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 */ - { '^', "vibrating square", C(CLR_YELLOW) }, /* trap */ - { '|', "wall", C(CLR_GRAY) }, /* vbeam */ - { '-', "wall", C(CLR_GRAY) }, /* hbeam */ - { '\\', "wall", C(CLR_GRAY) }, /* lslant */ - { '/', "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 */ - { '0', "", C(HI_ZAP) }, /* 4 magic shield symbols */ - { '#', "", C(HI_ZAP) }, - { '@', "", C(HI_ZAP) }, - { '*', "", C(HI_ZAP) }, - { '#', "poison cloud", - C(CLR_BRIGHT_GREEN) }, /* [part of] a poison cloud */ - { '?', "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 middle left */ - { '|', "", C(CLR_GREEN) }, /* swallow middle right */ - { '\\', "", 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 right */ - { '\\', "", C(CLR_ORANGE) }, /* explosion bottom left */ - { '-', "", C(CLR_ORANGE) }, /* explosion bottom center*/ - { '/', "", C(CLR_ORANGE) }, /* explosion bottom right */ +/* 0*/ { ' ', "dark part of a room", C(NO_COLOR) }, /* stone */ + { '|', "wall", C(CLR_GRAY) }, /* vwall */ + { '-', "wall", C(CLR_GRAY) }, /* hwall */ + { '-', "wall", C(CLR_GRAY) }, /* tlcorn */ + { '-', "wall", C(CLR_GRAY) }, /* trcorn */ + { '-', "wall", C(CLR_GRAY) }, /* blcorn */ + { '-', "wall", C(CLR_GRAY) }, /* brcorn */ + { '-', "wall", C(CLR_GRAY) }, /* crwall */ + { '-', "wall", C(CLR_GRAY) }, /* tuwall */ + { '-', "wall", C(CLR_GRAY) }, /* tdwall */ +/*10*/ { '|', "wall", C(CLR_GRAY) }, /* tlwall */ + { '|', "wall", C(CLR_GRAY) }, /* trwall */ + { '.', "doorway", C(CLR_GRAY) }, /* ndoor */ + { '-', "open door", C(CLR_BROWN) }, /* vodoor */ + { '|', "open door", C(CLR_BROWN) }, /* hodoor */ + { '+', "closed door", C(CLR_BROWN) }, /* vcdoor */ + { '+', "closed door", C(CLR_BROWN) }, /* hcdoor */ + { '#', "iron bars", C(HI_METAL) }, /* bars */ + { '#', "tree", C(CLR_GREEN) }, /* tree */ + { '.', "floor of a room", C(CLR_GRAY) }, /* room */ +/*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 */ + { '<', "ladder up", C(CLR_BROWN) }, /* upladder */ + { '>', "ladder down", C(CLR_BROWN) }, /* dnladder */ + { '_', "altar", C(CLR_GRAY) }, /* altar */ + { '|', "grave", C(CLR_GRAY) }, /* grave */ + { '\\', "opulent throne", C(HI_GOLD) }, /* throne */ +/*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 */ + { '.', "lowered drawbridge", C(CLR_BROWN) }, /* vodbridge */ + { '.', "lowered drawbridge", C(CLR_BROWN) }, /* hodbridge */ + { '#', "raised drawbridge", C(CLR_BROWN) }, /* vcdbridge */ + { '#', "raised drawbridge", C(CLR_BROWN) }, /* hcdbridge */ + { ' ', "air", C(CLR_CYAN) }, /* open air */ +/*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 */ + { '^', "squeaky board", C(CLR_BROWN) }, /* trap */ + { '^', "bear trap", C(HI_METAL) }, /* trap */ + { '^', "land mine", C(CLR_RED) }, /* trap */ + { '^', "rolling boulder trap", C(CLR_GRAY) }, /* trap */ + { '^', "sleeping gas trap", C(HI_ZAP) }, /* 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 */ + { '^', "trap door", C(CLR_BROWN) }, /* trap */ + { '^', "teleportation trap", C(CLR_MAGENTA) }, /* trap */ + { '^', "level teleporter", C(CLR_MAGENTA) }, /* trap */ + { '^', "magic portal", C(CLR_BRIGHT_MAGENTA) }, /* trap */ + { '"', "web", C(CLR_GRAY) }, /* web */ +/*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 */ + { '^', "vibrating square", C(CLR_YELLOW) }, /* trap */ + { '|', "wall", C(CLR_GRAY) }, /* vbeam */ + { '-', "wall", C(CLR_GRAY) }, /* hbeam */ + { '\\', "wall", C(CLR_GRAY) }, /* lslant */ + { '/', "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 */ + { '0', "", C(HI_ZAP) }, /* 4 magic shield symbols */ + { '#', "", C(HI_ZAP) }, + { '@', "", C(HI_ZAP) }, + { '*', "", C(HI_ZAP) }, + { '#', "poison cloud", C(CLR_BRIGHT_GREEN) }, /* part of a cloud */ + { '?', "valid position", C(CLR_BRIGHT_GREEN) }, /* target position */ + { '/', "", C(CLR_GREEN) }, /* swallow top left */ + { '-', "", C(CLR_GREEN) }, /* swallow top center */ + { '\\', "", C(CLR_GREEN) }, /* swallow top right */ +/*80*/ { '|', "", C(CLR_GREEN) }, /* swallow middle left */ + { '|', "", C(CLR_GREEN) }, /* swallow middle right */ + { '\\', "", 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 right */ + { '\\', "", C(CLR_ORANGE) }, /* explosion bottom left */ + { '-', "", C(CLR_ORANGE) }, /* explosion bottom center*/ + { '/', "", C(CLR_ORANGE) }, /* explosion bottom right */ }; /* default rogue level symbols */ static const uchar def_r_oc_syms[MAXOCLASSES] = { - /* 0*/ '\0', ILLOBJ_SYM, WEAPON_SYM, ']', /* armor */ - RING_SYM, - /* 5*/ ',', /* amulet */ - TOOL_SYM, ':', /* food */ - POTION_SYM, SCROLL_SYM, - /*10*/ SPBOOK_SYM, WAND_SYM, - GEM_SYM, /* gold -- yes it's the same as gems */ - GEM_SYM, ROCK_SYM, - /*15*/ BALL_SYM, CHAIN_SYM, VENOM_SYM +/* 0*/ '\0', ILLOBJ_SYM, WEAPON_SYM, ']', /* armor */ + RING_SYM, +/* 5*/ ',', /* amulet */ + TOOL_SYM, ':', /* food */ + POTION_SYM, SCROLL_SYM, +/*10*/ SPBOOK_SYM, WAND_SYM, + GEM_SYM, /* gold -- yes it's the same as gems */ + GEM_SYM, ROCK_SYM, +/*15*/ BALL_SYM, CHAIN_SYM, VENOM_SYM }; #undef C #ifdef TERMLIB void NDECL((*decgraphics_mode_callback)) = 0; /* set in tty_start_screen() */ -#endif /* TERMLIB */ +#endif /* TERMLIB */ #ifdef PC9800 void NDECL((*ibmgraphics_mode_callback)) = 0; /* set in tty_start_screen() */ @@ -330,7 +328,7 @@ char ch; * symbols from r_syms into showsyms. * * If arg is PRIMARY, this places the symbols - * from l_monsyms into showsyms. + * from l_monsyms into showsyms. * * update_l_symset() * Update a member of the loadable (l_*) symbol set. @@ -363,19 +361,17 @@ init_showsyms() for (i = 0; i < MAXPCHARS; i++) showsyms[i + SYM_OFF_P] = defsyms[i].sym; - for (i = 0; i < MAXOCLASSES; i++) showsyms[i + SYM_OFF_O] = def_oc_syms[i].sym; - for (i = 0; i < MAXMCLASSES; i++) showsyms[i + SYM_OFF_M] = def_monsyms[i].sym; - for (i = 0; i < WARNCOUNT; i++) showsyms[i + SYM_OFF_W] = def_warnsyms[i].sym; - for (i = 0; i < MAXOTHER; i++) { if (i == SYM_BOULDER) - showsyms[i + SYM_OFF_X] = iflags.bouldersym ? iflags.bouldersym : def_oc_syms[ROCK_CLASS].sym; + showsyms[i + SYM_OFF_X] = iflags.bouldersym + ? iflags.bouldersym + : def_oc_syms[ROCK_CLASS].sym; else if (i == SYM_INVISIBLE) showsyms[i + SYM_OFF_X] = DEF_INVISIBLE; } @@ -389,19 +385,17 @@ init_l_symbols() for (i = 0; i < MAXPCHARS; i++) l_syms[i + SYM_OFF_P] = defsyms[i].sym; - for (i = 0; i < MAXOCLASSES; i++) l_syms[i + SYM_OFF_O] = def_oc_syms[i].sym; - for (i = 0; i < MAXMCLASSES; i++) l_syms[i + SYM_OFF_M] = def_monsyms[i].sym; - for (i = 0; i < WARNCOUNT; i++) l_syms[i + SYM_OFF_W] = def_warnsyms[i].sym; - for (i = 0; i < MAXOTHER; i++) { if (i == SYM_BOULDER) - l_syms[i + SYM_OFF_X] = iflags.bouldersym ? iflags.bouldersym : def_oc_syms[ROCK_CLASS].sym; + l_syms[i + SYM_OFF_X] = iflags.bouldersym + ? iflags.bouldersym + : def_oc_syms[ROCK_CLASS].sym; else if (i == SYM_INVISIBLE) l_syms[i + SYM_OFF_X] = DEF_INVISIBLE; } @@ -424,25 +418,24 @@ init_r_symbols() for (i = 0; i < MAXOCLASSES; i++) r_syms[i + SYM_OFF_O] = def_r_oc_syms[i]; - for (i = 0; i < MAXMCLASSES; i++) r_syms[i + SYM_OFF_M] = def_monsyms[i].sym; - for (i = 0; i < WARNCOUNT; i++) r_syms[i + SYM_OFF_W] = def_warnsyms[i].sym; - for (i = 0; i < MAXOTHER; i++) { if (i == SYM_BOULDER) - r_syms[i + SYM_OFF_X] = iflags.bouldersym ? iflags.bouldersym : def_oc_syms[ROCK_CLASS].sym; + r_syms[i + SYM_OFF_X] = iflags.bouldersym + ? iflags.bouldersym + : def_oc_syms[ROCK_CLASS].sym; else if (i == SYM_INVISIBLE) r_syms[i + SYM_OFF_X] = DEF_INVISIBLE; } clear_symsetentry(ROGUESET, FALSE); - symset[ROGUESET].nocolor = 1; /* default on Rogue level is no color - * but some symbol sets can - * override that - */ + /* default on Rogue level is no color + * but some symbol sets can override that + */ + symset[ROGUESET].nocolor = 1; } void diff --git a/src/exper.c b/src/exper.c index ed3860a2b..4f72e9784 100644 --- a/src/exper.c +++ b/src/exper.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 exper.c $NHDT-Date: 1432512770 2015/05/25 00:12:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $ */ +/* NetHack 3.6 exper.c $NHDT-Date: 1446975467 2015/11/08 09:37:47 $ $NHDT-Branch: master $:$NHDT-Revision: 1.26 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -34,7 +34,7 @@ int en; case PM_VALKYRIE: return ((3 * en) / 4); default: - return (en); + return en; } } @@ -68,7 +68,9 @@ newpw() return en; } -int experience(mtmp, nk) /* return # of exp points for mtmp after nk killed */ +/* return # of exp points for mtmp after nk killed */ +int +experience(mtmp, nk) register struct monst *mtmp; register int nk; { @@ -77,15 +79,15 @@ register int nk; tmp = 1 + mtmp->m_lev * mtmp->m_lev; - /* For higher ac values, give extra experience */ + /* For higher ac values, give extra experience */ if ((i = find_mac(mtmp)) < 3) tmp += (7 - i) * ((i < 0) ? 2 : 1); - /* For very fast monsters, give extra experience */ + /* For very fast monsters, give extra experience */ if (ptr->mmove > NORMAL_SPEED) tmp += (ptr->mmove > (3 * NORMAL_SPEED / 2)) ? 5 : 3; - /* For each "special" attack type give extra experience */ + /* For each "special" attack type give extra experience */ for (i = 0; i < NATTK; i++) { tmp2 = ptr->mattk[i].aatyp; if (tmp2 > AT_BUTT) { @@ -98,7 +100,7 @@ register int nk; } } - /* For each "special" damage type give extra experience */ + /* For each "special" damage type give extra experience */ for (i = 0; i < NATTK; i++) { tmp2 = ptr->mattk[i].adtyp; if (tmp2 > AD_PHYS && tmp2 < AD_BLND) @@ -114,11 +116,11 @@ register int nk; tmp += 1000; } - /* For certain "extra nasty" monsters, give even more */ + /* For certain "extra nasty" monsters, give even more */ if (extra_nasty(ptr)) tmp += (7 * mtmp->m_lev); - /* For higher level monsters, an additional bonus is given */ + /* For higher level monsters, an additional bonus is given */ if (mtmp->m_lev > 8) tmp += 50; @@ -130,17 +132,17 @@ register int nk; if (mtmp->mrevived || mtmp->mcloned) { /* - * Reduce experience awarded for repeated killings of - * "the same monster". Kill count includes all of this - * monster's type which have been killed--including the - * current monster--regardless of how they were created. - * 1.. 20 full experience - * 21.. 40 xp / 2 - * 41.. 80 xp / 4 - * 81..120 xp / 8 - * 121..180 xp / 16 - * 181..240 xp / 32 - * 241..255+ xp / 64 + * Reduce experience awarded for repeated killings of + * "the same monster". Kill count includes all of this + * monster's type which have been killed--including the + * current monster--regardless of how they were created. + * 1.. 20 full experience + * 21.. 40 xp / 2 + * 41.. 80 xp / 4 + * 81..120 xp / 8 + * 121..180 xp / 16 + * 181..240 xp / 32 + * 241..255+ xp / 64 */ for (i = 0, tmp2 = 20; nk > tmp2 && tmp > 1; ++i) { tmp = (tmp + 1) / 2; @@ -256,7 +258,7 @@ newexplevel() void pluslvl(incr) boolean incr; /* true iff via incremental experience growth */ -{ /* (false for potion of gain level) */ +{ /* (false for potion of gain level) */ int hpinc, eninc; if (!incr) diff --git a/src/extralev.c b/src/extralev.c index 97136e7b2..54e935e08 100644 --- a/src/extralev.c +++ b/src/extralev.c @@ -1,5 +1,5 @@ -/* NetHack 3.6 extralev.c $NHDT-Date: 1432512765 2015/05/25 00:12:45 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */ -/* Copyright 1988, 1989 by Ken Arromdee */ +/* NetHack 3.6 extralev.c $NHDT-Date: 1446975468 2015/11/08 09:37:48 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */ +/* Copyright 1988, 1989 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ /* @@ -206,22 +206,22 @@ void makeroguerooms() { register int x, y; -/* Rogue levels are structured 3 by 3, with each section containing - * a room or an intersection. The minimum width is 2 each way. - * One difference between these and "real" Rogue levels: real Rogue - * uses 24 rows and NetHack only 23. So we cheat a bit by making the - * second row of rooms not as deep. - * - * Each normal space has 6/7 rows and 25 columns in which a room may - * actually be placed. Walls go from rows 0-5/6 and columns 0-24. - * Not counting walls, the room may go in - * rows 1-5 and columns 1-23 (numbering starting at 0). A room - * coordinate of this type may be converted to a level coordinate - * by adding 1+28*x to the column, and 7*y to the row. (The 1 - * is because column 0 isn't used [we only use 1-78]). - * Room height may be 2-4 (2-5 on last row), length 2-23 (not - * counting walls) - */ + /* Rogue levels are structured 3 by 3, with each section containing + * a room or an intersection. The minimum width is 2 each way. + * One difference between these and "real" Rogue levels: real Rogue + * uses 24 rows and NetHack only 23. So we cheat a bit by making the + * second row of rooms not as deep. + * + * Each normal space has 6/7 rows and 25 columns in which a room may + * actually be placed. Walls go from rows 0-5/6 and columns 0-24. + * Not counting walls, the room may go in + * rows 1-5 and columns 1-23 (numbering starting at 0). A room + * coordinate of this type may be converted to a level coordinate + * by adding 1+28*x to the column, and 7*y to the row. (The 1 + * is because column 0 isn't used [we only use 1-78]). + * Room height may be 2-4 (2-5 on last row), length 2-23 (not + * counting walls). + */ #define here r[x][y] nroom = 0;