Merge branch 'master' of https://rodney.nethack.org:20040/git/NHsource into paxed-new_lev_comp

Conflicts:
	src/trap.c
	sys/winnt/Makefile.msc
This commit is contained in:
Pasi Kallinen
2015-04-01 16:09:53 +03:00
99 changed files with 4503 additions and 2521 deletions
+1 -1
View File
@@ -292,7 +292,7 @@ boolean resuming;
}
restore_attrib();
/* underwater and waterlevel vision are done here */
if (Is_waterlevel(&u.uz))
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
movebubbles();
else if (Underwater)
under_water(0);
+134 -29
View File
@@ -20,6 +20,7 @@ STATIC_DCL void FDECL(use_candelabrum, (struct obj *));
STATIC_DCL void FDECL(use_candle, (struct obj **));
STATIC_DCL void FDECL(use_lamp, (struct obj *));
STATIC_DCL void FDECL(light_cocktail, (struct obj *));
STATIC_PTR void FDECL(display_jump_positions, (int));
STATIC_DCL void FDECL(use_tinning_kit, (struct obj *));
STATIC_DCL void FDECL(use_figurine, (struct obj **));
STATIC_DCL void FDECL(use_grease, (struct obj *));
@@ -27,6 +28,7 @@ STATIC_DCL void FDECL(use_trap, (struct obj *));
STATIC_DCL void FDECL(use_stone, (struct obj *));
STATIC_PTR int NDECL(set_trap); /* occupation callback */
STATIC_DCL int FDECL(use_whip, (struct obj *));
STATIC_PTR void FDECL(display_polearm_positions, (int));
STATIC_DCL int FDECL(use_pole, (struct obj *));
STATIC_DCL int FDECL(use_cream_pie, (struct obj *));
STATIC_DCL int FDECL(use_grapple, (struct obj *));
@@ -736,8 +738,10 @@ struct obj *obj;
pline("Yow! The %s stares back!", mirror);
else
pline("Yikes! You've frozen yourself!");
if (!Hallucination || !rn2(4))
if (!Hallucination || !rn2(4)) {
nomul(-rnd(MAXULEV + 6 - u.ulevel));
multi_reason = "gazing into a mirror";
}
nomovemsg = 0; /* default, "you can move again" */
}
} else if (youmonst.data->mlet == S_VAMPIRE)
@@ -915,6 +919,7 @@ struct obj **optr;
break;
case 2: /* no explanation; it just happens... */
nomovemsg = "";
multi_reason = NULL;
nomul(-rnd(2));
break;
}
@@ -1357,6 +1362,53 @@ dojump()
return jump(0);
}
boolean
is_valid_jump_pos(x,y, magic, showmsg)
int x,y, magic;
boolean showmsg;
{
if (!magic && !(HJumping & ~INTRINSIC) && !EJumping &&
distu(x, y) != 5) {
/* The Knight jumping restriction still applies when riding a
* horse. After all, what shape is the knight piece in chess?
*/
if (showmsg) pline("Illegal move!");
return FALSE;
} else if (distu(x, y) > (magic ? 6+magic*3 : 9)) {
if (showmsg) pline("Too far!");
return FALSE;
} else if (!cansee(x, y)) {
if (showmsg) You("cannot see where to land!");
return FALSE;
} else if (!isok(x, y)) {
if (showmsg) You("cannot jump there!");
return FALSE;
}
return TRUE;
}
int jumping_is_magic;
void
display_jump_positions(state)
int state;
{
if (state == 0) {
tmp_at(DISP_BEAM, cmap_to_glyph(S_flashbeam));
} else if (state == 1) {
int x,y, dx, dy;
for (dx = -4; dx <= 4; dx++)
for (dy = -4; dy <= 4; dy++) {
x = dx + (int)u.ux;
y = dy + (int)u.uy;
if (isok(x,y) && is_valid_jump_pos(x,y, jumping_is_magic, FALSE))
tmp_at(x,y);
}
} else {
tmp_at(DISP_END, 0);
}
}
int
jump(magic)
int magic; /* 0=Physical, otherwise skill level */
@@ -1436,24 +1488,12 @@ int magic; /* 0=Physical, otherwise skill level */
pline("Where do you want to jump?");
cc.x = u.ux;
cc.y = u.uy;
jumping_is_magic = magic;
getpos_sethilite(display_jump_positions);
if (getpos(&cc, TRUE, "the desired position") < 0)
return 0; /* user pressed ESC */
if (!magic && !(HJumping & ~INTRINSIC) && !EJumping &&
distu(cc.x, cc.y) != 5) {
/* The Knight jumping restriction still applies when riding a
* horse. After all, what shape is the knight piece in chess?
*/
pline("Illegal move!");
return 0;
} else if (distu(cc.x, cc.y) > (magic ? 6+magic*3 : 9)) {
pline("Too far!");
return 0;
} else if (!cansee(cc.x, cc.y)) {
You("cannot see where to land!");
return 0;
} else if (!isok(cc.x, cc.y)) {
You("cannot jump there!");
return 0;
if (!is_valid_jump_pos(cc.x, cc.y, magic, TRUE)) {
return 0;
} else {
coord uc;
int range, temp;
@@ -1508,6 +1548,7 @@ int magic; /* 0=Physical, otherwise skill level */
teleds(cc.x, cc.y, TRUE);
sokoban_guilt();
nomul(-1);
multi_reason = "jumping around";
nomovemsg = "";
morehungry(rnd(25));
return 1;
@@ -2531,6 +2572,54 @@ static const char
cant_see_spot[] = "won't hit anything if you can't see that spot.",
cant_reach[] = "can't reach that spot from here.";
/* find pos of monster in range, if only one monster */
boolean
find_poleable_mon(pos, min_range, max_range)
coord *pos;
int min_range, max_range;
{
struct monst *mtmp;
struct monst *selmon = NULL;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
if (mtmp && !DEADMONSTER(mtmp) && !mtmp->mtame &&
cansee(mtmp->mx, mtmp->my) &&
distu(mtmp->mx, mtmp->my) <= max_range &&
distu(mtmp->mx, mtmp->my) >= min_range) {
if (selmon) return FALSE;
selmon = mtmp;
}
if (!selmon) return FALSE;
pos->x = selmon->mx;
pos->y = selmon->my;
return TRUE;
}
int polearm_range_min = -1;
int polearm_range_max = -1;
void
display_polearm_positions(state)
int state;
{
if (state == 0) {
tmp_at(DISP_BEAM, cmap_to_glyph(S_flashbeam));
} else if (state == 1) {
int x,y, dx,dy;
for (dx = -4; dx <= 4; dx++)
for (dy = -4; dy <= 4; dy++) {
x = dx + (int)u.ux;
y = dy + (int)u.uy;
if (isok(x, y) &&
distu(x, y) >= polearm_range_min &&
distu(x, y) <= polearm_range_max) {
tmp_at(x, y);
}
}
} else {
tmp_at(DISP_END, 0);
}
}
/* Distance attacks by pole-weapons */
STATIC_OVL int
use_pole(obj)
@@ -2539,6 +2628,7 @@ use_pole(obj)
int res = 0, typ, max_range, min_range, glyph;
coord cc;
struct monst *mtmp;
struct monst *hitm = context.polearm.hitmon;
/* Are you allowed to use the pole? */
if (u.uswallow) {
@@ -2551,15 +2641,7 @@ use_pole(obj)
}
/* assert(obj == uwep); */
/* Prompt for a location */
pline(where_to_hit);
cc.x = u.ux;
cc.y = u.uy;
if (getpos(&cc, TRUE, "the spot to hit") < 0)
return res; /* ESC; uses turn iff polearm became wielded */
glyph = glyph_at(cc.x, cc.y);
/*
/*
* Calculate allowable range (pole's reach is always 2 steps):
* unskilled and basic: orthogonal direction, 4..4;
* skilled: as basic, plus knight's jump position, 4..5;
@@ -2579,6 +2661,26 @@ use_pole(obj)
if (typ == P_NONE || P_SKILL(typ) <= P_BASIC) max_range = 4;
else if (P_SKILL(typ) == P_SKILLED) max_range = 5;
else max_range = 8; /* (P_SKILL(typ) >= P_EXPERT) */
polearm_range_min = min_range;
polearm_range_max = max_range;
/* Prompt for a location */
pline(where_to_hit);
cc.x = u.ux;
cc.y = u.uy;
if (!find_poleable_mon(&cc, min_range, max_range) &&
hitm && !DEADMONSTER(hitm) && cansee(hitm->mx, hitm->my) &&
distu(hitm->mx,hitm->my) <= max_range &&
distu(hitm->mx,hitm->my) >= min_range) {
cc.x = hitm->mx;
cc.y = hitm->my;
}
getpos_sethilite(display_polearm_positions);
if (getpos(&cc, TRUE, "the spot to hit") < 0)
return res; /* ESC; uses turn iff polearm became wielded */
glyph = glyph_at(cc.x, cc.y);
if (distu(cc.x, cc.y) > max_range) {
pline("Too far!");
return (res);
@@ -2596,11 +2698,13 @@ use_pole(obj)
return res;
}
context.polearm.hitmon = NULL;
/* Attack the monster there */
bhitpos = cc;
if ((mtmp = m_at(bhitpos.x, bhitpos.y)) != (struct monst *)0) {
if (attack_checks(mtmp, uwep)) return res;
if (overexertion()) return 1; /* burn nutrition; maybe pass out */
context.polearm.hitmon = mtmp;
check_caitiff(mtmp);
notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my);
(void) thitmonst(mtmp, uwep);
@@ -2828,6 +2932,7 @@ do_break_wand(obj)
boolean fillmsg = FALSE;
int expltype = EXPL_MAGICAL;
char confirm[QBUFSZ], buf[BUFSZ];
boolean is_fragile = (!strcmp(OBJ_DESCR(objects[obj->otyp]), "balsa"));
if (yn(safe_qbuf(confirm, "Are you really sure you want to break ", "?",
obj, yname, ysimple_name, "the wand")) == 'n')
@@ -2836,7 +2941,7 @@ do_break_wand(obj)
if (nohands(youmonst.data)) {
You_cant("break %s without hands!", yname(obj));
return 0;
} else if (ACURR(A_STR) < 10) {
} else if (ACURR(A_STR) < (is_fragile ? 5 : 10)) {
You("don't have the strength to break %s!", yname(obj));
return 0;
}
@@ -2974,7 +3079,7 @@ do_break_wand(obj)
/* if (context.botl) bot(); */
}
if (affects_objects && level.objects[x][y]) {
(void) bhitpile(obj, bhito, x, y);
(void) bhitpile(obj, bhito, x, y, 0);
if (context.botl) bot(); /* potion effects */
}
} else {
@@ -2991,7 +3096,7 @@ do_break_wand(obj)
* since it's also used by retouch_equipment() for polyself.)
*/
if (affects_objects && level.objects[x][y]) {
(void) bhitpile(obj, bhito, x, y);
(void) bhitpile(obj, bhito, x, y, 0);
if (context.botl) bot(); /* potion effects */
}
damage = zapyourself(obj, FALSE);
+1
View File
@@ -983,6 +983,7 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */
resisted = TRUE;
} else {
nomul(-3);
multi_reason = "being scared stiff";
nomovemsg = "";
if (magr && magr == u.ustuck && sticks(youmonst.data)) {
u.ustuck = (struct monst *)0;
+2
View File
@@ -691,6 +691,8 @@ int propidx; /* special cases can have negative values */
Sprintf(buf, because_of,
obj->oartifact ? bare_artifactname(obj) :
ysimple_name(obj));
else if (propidx == BLINDED && u.uroleplay.blind)
Sprintf(buf, " from birth");
else if (propidx == BLINDED && Blindfolded_only)
Sprintf(buf, because_of, ysimple_name(ublindf));
+13 -8
View File
@@ -509,6 +509,16 @@ enter_explore_mode(VOID_ARGS)
} else if (discover) {
You("are already in explore mode.");
} else {
#ifdef SYSCF
# if defined(UNIX)
if (!sysopt.explorers ||
!sysopt.explorers[0] ||
!check_user_string(sysopt.explorers)) {
You("cannot access explore mode.");
return 0;
}
# endif
#endif
pline(
"Beware! From explore mode there will be no return to normal game.");
if (paranoid_query(ParanoidQuit,
@@ -997,11 +1007,8 @@ wiz_levltyp_legend(VOID_ARGS)
STATIC_PTR int
wiz_smell(VOID_ARGS)
{
char out_str[BUFSZ];
struct permonst *pm = 0;
int ans = 0;
int mndx; /* monster index */
int found; /* count of matching mndxs found */
coord cc; /* screen pos of unknown glyph */
int glyph; /* glyph at selected position */
@@ -1015,11 +1022,6 @@ wiz_smell(VOID_ARGS)
pline("You can move the cursor to a monster that you want to smell.");
do {
/* Reset some variables. */
pm = (struct permonst *)0;
found = 0;
out_str[0] = '\0';
pline("Pick a monster to smell.");
ans = getpos(&cc, TRUE, "a monster");
if (ans < 0 || cc.x < 0) {
@@ -2246,6 +2248,9 @@ int final;
en_win = create_nhwindow(NHW_MENU);
putstr(en_win, 0, "Voluntary challenges:");
if (u.uroleplay.blind) you_have_been("blind from birth");
if (u.uroleplay.nudist) you_have_been("faithfully nudist");
if (!u.uconduct.food)
enl_msg(You_, "have gone", "went", " without food", "");
/* But beverages are okay */
+1
View File
@@ -21,6 +21,7 @@ char *catmore = 0; /* default pager */
NEARDATA int bases[MAXOCLASSES] = DUMMY;
NEARDATA int multi = 0;
const char *multi_reason = NULL;
NEARDATA int nroom = 0;
NEARDATA int nsubroom = 0;
NEARDATA int occtime = 0;
+1
View File
@@ -890,6 +890,7 @@ struct obj *obj;
}
You("peer into %s...", the(xname(obj)));
nomul(-rnd(10));
multi_reason = "gazing into a crystal ball";
nomovemsg = "";
if (obj->spe <= 0)
pline_The("vision is unclear.");
+3 -2
View File
@@ -1023,6 +1023,7 @@ struct obj *obj;
/* you ought to be able to let go; tough luck */
/* (maybe `move_into_trap()' would be better) */
nomul(-d(2,2));
multi_reason = "stuck in a spider web";
nomovemsg = "You pull free.";
} else if (lev->typ == IRONBARS) {
pline("Clang!");
@@ -1283,7 +1284,7 @@ zap_dig()
struct monst *mtmp;
struct obj *otmp;
struct trap *trap_with_u = (struct trap *)0;
int zx, zy, diridx, digdepth, flow_x, flow_y;
int zx, zy, diridx = 8, digdepth, flow_x = -1, flow_y = -1;
boolean shopdoor, shopwall, maze_dig, pitdig = FALSE, pitflow = FALSE;
/*
@@ -1461,7 +1462,7 @@ zap_dig()
} /* while */
tmp_at(DISP_END,0); /* closing call */
if (pitflow) {
if (pitflow && isok(flow_x, flow_y)) {
struct trap *ttmp = t_at(flow_x, flow_y);
if (ttmp && (ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT)) {
schar filltyp = fillholetyp(ttmp->tx, ttmp->ty, TRUE);
+2 -1
View File
@@ -1286,7 +1286,7 @@ boolean at_stairs, falling, portal;
}
/* initial movement of bubbles just before vision_recalc */
if (Is_waterlevel(&u.uz))
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
movebubbles();
if (level_info[new_ledger].flags & FORGOTTEN) {
@@ -1402,6 +1402,7 @@ boolean at_stairs, falling, portal;
/* assume this will always return TRUE when changing level */
(void) in_out_region(u.ux, u.uy);
(void) pickup(1);
context.polearm.hitmon = NULL;
}
STATIC_OVL void
+30 -1
View File
@@ -25,6 +25,17 @@ nextmbuf()
return bufs[bufidx];
}
/* function for getpos() to highlight desired map locations.
* parameter value 0 = initialize, 1 = highlight, 2 = done
*/
void (*getpos_hilitefunc)(int) = NULL;
void
getpos_sethilite(f)
void (*f)(int);
{
getpos_hilitefunc = f;
}
/* the response for '?' help request in getpos() */
STATIC_OVL void
getpos_help(force, goal)
@@ -41,6 +52,8 @@ const char *goal;
putstr(tmpwin, 0, "Use [HJKL] to move the cursor 8 units at a time.");
putstr(tmpwin, 0, "Or enter a background symbol (ex. <).");
putstr(tmpwin, 0, "Use @ to move the cursor on yourself.");
if (getpos_hilitefunc != NULL)
putstr(tmpwin, 0, "Use $ to display valid locations.");
putstr(tmpwin, 0, "Use # to toggle automatic description.");
/* disgusting hack; the alternate selection characters work for any
getpos call, but they only matter for dowhatis (and doquickwhatis) */
@@ -69,6 +82,7 @@ const char *goal;
boolean show_goal_msg = FALSE;
static const char pick_chars[] = ".,;:";
const char *cp;
boolean hilite_state = FALSE;
if (!goal) goal = "desired location";
if (flags.verbose) {
@@ -92,7 +106,7 @@ const char *goal;
curs(WIN_MAP, cx, cy);
flush_screen(0);
show_goal_msg = FALSE;
} else if (auto_msg && !msg_given) {
} else if (auto_msg && !msg_given && !hilite_state) {
coord cc;
int sym = 0;
char tmpbuf[BUFSZ];
@@ -110,6 +124,13 @@ const char *goal;
c = nh_poskey(&tx, &ty, &sidx);
if (hilite_state) {
(*getpos_hilitefunc)(2);
hilite_state = FALSE;
curs(WIN_MAP, cx, cy);
flush_screen(0);
}
if (auto_msg)
msg_given = FALSE;
@@ -174,6 +195,13 @@ const char *goal;
/* update message window to reflect that we're still targetting */
show_goal_msg = TRUE;
msg_given = TRUE;
} else if ((c == '$') && (getpos_hilitefunc != NULL)) {
if (!hilite_state) {
(*getpos_hilitefunc)(0);
(*getpos_hilitefunc)(1);
hilite_state = TRUE;
}
goto nxtc;
} else if (c == '#') {
auto_msg = !auto_msg;
pline("Automatic description %sis %s.",
@@ -269,6 +297,7 @@ const char *goal;
if (msg_given) clear_nhwindow(WIN_MESSAGE);
ccp->x = cx;
ccp->y = cy;
getpos_hilitefunc = NULL;
return result;
}
+2
View File
@@ -1407,6 +1407,7 @@ register struct obj *otmp;
if(cursed(otmp)) return(0);
if(delay) {
nomul(delay);
multi_reason = "disrobing";
if (is_helmet(otmp)) {
/* ick... */
nomovemsg = !strcmp(helm_simple_name(otmp), "hat") ?
@@ -1664,6 +1665,7 @@ dowear()
delay = -objects[otmp->otyp].oc_delay;
if(delay){
nomul(delay);
multi_reason = "dressing up";
if(is_boots(otmp)) afternmv = Boots_on;
if(is_helmet(otmp)) afternmv = Helmet_on;
if(is_gloves(otmp)) afternmv = Gloves_on;
+3 -2
View File
@@ -423,7 +423,7 @@ boolean with_you;
* probably because the level is full.
* Dump the monster's cargo and leave the monster dead.
*/
struct obj *obj, *corpse;
struct obj *obj;
while ((obj = mtmp->minvent) != 0) {
obj_extract_self(obj);
obj_no_longer_held(obj);
@@ -437,7 +437,7 @@ boolean with_you;
impossible("Can't find relocated object.");
}
}
corpse = mkcorpstat(CORPSE, (struct monst *)0, mtmp->data,
(void) mkcorpstat(CORPSE, (struct monst *)0, mtmp->data,
xlocale, ylocale, CORPSTAT_NONE);
mongone(mtmp);
}
@@ -685,6 +685,7 @@ migrate_to_level(mtmp, tolev, xyloc, cc)
mtmp->mux = new_lev.dnum;
mtmp->muy = new_lev.dlevel;
mtmp->mx = mtmp->my = 0; /* this implies migration */
if (mtmp == context.polearm.hitmon) context.polearm.hitmon = NULL;
}
/* return quality of food; the lower the better */
+22 -1
View File
@@ -991,7 +991,28 @@ dokick()
exercise(A_DEX, TRUE);
return(1);
}
if(IS_GRAVE(maploc->typ) || maploc->typ == IRONBARS)
if (IS_GRAVE(maploc->typ)) {
if(Levitation) goto dumb;
if (rn2(4)) goto ouch;
exercise(A_WIS, FALSE);
if (Role_if(PM_ARCHEOLOGIST) ||
Role_if(PM_SAMURAI) ||
((u.ualign.type == A_LAWFUL) && (u.ualign.record > -10))) {
adjalign(-sgn(u.ualign.type));
}
maploc->typ = ROOM;
maploc->doormask = 0;
(void) mksobj_at(ROCK, x,y, TRUE, FALSE);
del_engr_at(x,y);
if (Blind)
pline("Crack! %s broke!", Something);
else {
pline_The("headstone topples over and breaks!");
newsym(x,y);
}
return 1;
}
if(maploc->typ == IRONBARS)
goto ouch;
if(IS_TREE(maploc->typ)) {
struct obj *treefruit;
+1
View File
@@ -693,6 +693,7 @@ hurtle(dx, dy, range, verbose)
if(!range || (!dx && !dy) || u.ustuck) return; /* paranoia */
nomul(-range);
multi_reason = "moving through the air";
nomovemsg = ""; /* it just happens */
if (verbose)
You("%s in the opposite direction.", range > 1 ? "hurtle" : "float");
+6
View File
@@ -962,6 +962,7 @@ register int pm;
/* A pile of gold can't ride. */
if (u.usteed) dismount_steed(DISMOUNT_FELL);
nomul(-tmp);
multi_reason = "pretending to be a pile of gold";
Sprintf(buf, Hallucination ?
"You suddenly dread being peeled and mimic %s again!" :
"You now prefer mimicking %s again.",
@@ -1479,6 +1480,7 @@ struct obj *obj;
pline_The("world spins and %s %s.", what, where);
incr_itimeout(&HDeaf, duration);
nomul(-duration);
multi_reason = "unconscious from rotten food";
nomovemsg = "You are conscious again.";
afternmv = Hear_again;
return(1);
@@ -1572,6 +1574,8 @@ eatcorpse(otmp) /* called when a corpse is selected as food */
} else if ((mnum == PM_COCKATRICE || mnum == PM_CHICKATRICE) &&
(Stone_resistance || Hallucination)) {
pline("This tastes just like chicken!");
} else if (mnum == PM_FLOATING_EYE && u.umonnum == PM_RAVEN) {
You("peck the eyeball with delight.");
} else {
/* [is this right? omnivores end up always disliking the taste] */
boolean yummy = (vegan(&mons[mnum]) ?
@@ -2677,6 +2681,7 @@ boolean incr;
if (!Levitation) selftouch("Falling, you");
incr_itimeout(&HDeaf, duration);
nomul(-duration);
multi_reason = "fainted from lack of food";
nomovemsg = "You regain consciousness.";
afternmv = unfaint;
newhs = FAINTED;
@@ -2853,6 +2858,7 @@ vomit() /* A good idea from David Neves */
else
make_sick(0L, (char *)0, TRUE, SICK_VOMITABLE);
nomul(-2);
multi_reason = "vomiting";
nomovemsg = You_can_move_again;
}
+6 -1
View File
@@ -465,7 +465,12 @@ int how;
Sprintf(eos(buf), " called %s", MNAME(mtmp));
}
if (multi) Strcat(buf, ", while helpless");
if (multi) {
if (multi_reason)
Sprintf(eos(buf), ", while %s", multi_reason);
else
Strcat(buf, ", while helpless");
}
Strcpy(killer.name, buf);
if (mptr->mlet == S_WRAITH)
u.ugrave_arise = PM_WRAITH;
+3
View File
@@ -2184,6 +2184,9 @@ int src;
} else if (src == SET_IN_SYS && match_varname(buf, "SHELLERS", 8)) {
if (sysopt.shellers) free(sysopt.shellers);
sysopt.shellers = dupstr(bufp);
} else if (src == SET_IN_SYS && match_varname(buf, "EXPLORERS", 7)) {
if (sysopt.explorers) free(sysopt.explorers);
sysopt.explorers = dupstr(bufp);
} else if (src == SET_IN_SYS && match_varname(buf, "DEBUGFILES", 5)) {
if (sysopt.debugfiles) free(sysopt.debugfiles);
/* if showdebug() has already been called (perhaps we've added
+24 -4
View File
@@ -630,8 +630,11 @@ int mode;
if (Passes_walls && may_passwall(x,y)) {
; /* do nothing */
} else if (tmpr->typ == IRONBARS) {
if (!(Passes_walls || passes_bars(youmonst.data)))
if (!(Passes_walls || passes_bars(youmonst.data))) {
if (iflags.mention_walls)
You("cannot pass through the bars.");
return FALSE;
}
} else if (tunnels(youmonst.data) && !needspick(youmonst.data)) {
/* Eat the rock. */
if (mode == DO_MOVE && still_chewing(x,y)) return FALSE;
@@ -646,8 +649,10 @@ int mode;
if (Is_stronghold(&u.uz) && is_db_wall(x,y))
pline_The("drawbridge is up!");
/* sokoban restriction stays even after puzzle is solved */
if (Passes_walls && !may_passwall(x,y) && In_sokoban(&u.uz))
else if (Passes_walls && !may_passwall(x,y) && In_sokoban(&u.uz))
pline_The("Sokoban walls resist your ability.");
else if (iflags.mention_walls)
pline("It's a wall.");
}
return FALSE;
}
@@ -1099,7 +1104,7 @@ domove()
register struct monst *mtmp;
register struct rm *tmpr;
register xchar x,y;
struct trap *trap;
struct trap *trap = (struct trap *)0;
int wtcap;
boolean on_ice;
xchar chainx, chainy, ballx, bally; /* ball&chain new positions */
@@ -1563,6 +1568,7 @@ domove()
/* must come after we finished picking up, in spoteffects() */
if (cause_delay) {
nomul(-2);
multi_reason = "dragging an iron ball";
nomovemsg = "";
}
@@ -2202,7 +2208,19 @@ dopickup()
}
}
if (!OBJ_AT(u.ux, u.uy)) {
There("is nothing here to pick up.");
register struct rm *lev = &levl[u.ux][u.uy];
if (IS_THRONE(lev->typ))
pline("It must weigh%s a ton!",
lev->looted ? " almost" : "");
else if (IS_SINK(lev->typ))
pline_The("plumbing connects it to the floor.");
else if (IS_GRAVE(lev->typ))
You("don't need a gravestone. Yet.");
else if (IS_FOUNTAIN(lev->typ))
You("could drink the water...");
else if (IS_DOOR(lev->typ) && (lev->doormask & D_ISOPEN))
pline("It won't come off the hinges.");
else There("is nothing here to pick up.");
return 0;
}
if (!can_reach_floor(TRUE)) {
@@ -2417,6 +2435,7 @@ nomul(nval)
u.uinvulnerable = FALSE; /* Kludge to avoid ctrl-C bug -dlc */
u.usleep = 0;
multi = nval;
if (nval == 0) multi_reason = NULL;
context.travel = context.travel1 = context.mv = context.run = 0;
}
@@ -2431,6 +2450,7 @@ const char *msg_override;
if (*nomovemsg) pline1(nomovemsg);
nomovemsg = 0;
u.usleep = 0;
multi_reason = NULL;
if (afternmv) (*afternmv)();
afternmv = 0;
}
+21 -9
View File
@@ -915,8 +915,8 @@ register const char *let,*word;
/* "ugly check" for reading fortune cookies, part 2 */
if ((!strcmp(word, "read")
&& (otmp->otyp == FORTUNE_COOKIE || otmp->otyp == T_SHIRT)))
allowall = TRUE;
&& is_readable(otmp)))
allowall = usegold = TRUE;
}
}
bp[foo] = 0;
@@ -1789,7 +1789,7 @@ nextclass:
if (!flags.sortpack || otmp->oclass == *invlet) {
if (flags.sortpack && !classcount) {
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
let_to_name(*invlet, FALSE), MENU_UNSELECTED);
let_to_name(*invlet, FALSE, (want_reply && iflags.menu_head_objsym)), MENU_UNSELECTED);
classcount++;
}
any.a_char = ilet;
@@ -1863,7 +1863,7 @@ char avoidlet;
if (flags.sortpack && !classcount) {
any = zeroany; /* zero */
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
let_to_name(*invlet, FALSE), MENU_UNSELECTED);
let_to_name(*invlet, FALSE, FALSE), MENU_UNSELECTED);
classcount++;
}
any.a_char = ilet;
@@ -1991,7 +1991,7 @@ dounpaid()
if (otmp->unpaid) {
if (!flags.sortpack || otmp->oclass == *invlet) {
if (flags.sortpack && !classcount) {
putstr(win, 0, let_to_name(*invlet, TRUE));
putstr(win, 0, let_to_name(*invlet, TRUE, FALSE));
classcount++;
}
@@ -2009,7 +2009,7 @@ dounpaid()
if (count > num_so_far) {
/* something unpaid is contained */
if (flags.sortpack)
putstr(win, 0, let_to_name(CONTAINED_SYM, TRUE));
putstr(win, 0, let_to_name(CONTAINED_SYM, TRUE, FALSE));
/*
* Search through the container objects in the inventory for
* unpaid items. The top level inventory items have already
@@ -2701,10 +2701,12 @@ static NEARDATA char *invbuf = (char *)0;
static NEARDATA unsigned invbufsiz = 0;
char *
let_to_name(let,unpaid)
let_to_name(let,unpaid,showsym)
char let;
boolean unpaid;
boolean unpaid,showsym;
{
const char *ocsymfmt = " ('%c')";
const int invbuf_sympadding = 8; /* arbitrary */
const char *class_name;
const char *pos;
int oclass = (let >= 1 && let < MAXOCLASSES) ? let : 0;
@@ -2717,7 +2719,8 @@ boolean unpaid;
else
class_name = names[0];
len = strlen(class_name) + (unpaid ? sizeof "unpaid_" : sizeof "");
len = strlen(class_name) + (unpaid ? sizeof "unpaid_" : sizeof "") +
(oclass ? (strlen(ocsymfmt)+invbuf_sympadding) : 0);
if (len > invbufsiz) {
if (invbuf) free((genericptr_t)invbuf);
invbufsiz = len + 10; /* add slop to reduce incremental realloc */
@@ -2727,6 +2730,15 @@ boolean unpaid;
Strcat(strcpy(invbuf, "Unpaid "), class_name);
else
Strcpy(invbuf, class_name);
if ((oclass != 0) && showsym) {
char *bp = eos(invbuf);
int mlen = invbuf_sympadding - strlen(class_name);
while (--mlen > 0) {
*bp = ' '; bp++;
}
*bp = '\0';
Sprintf(eos(invbuf), ocsymfmt, def_oc_syms[oclass].sym);
}
return invbuf;
}
+5
View File
@@ -437,6 +437,11 @@ struct obj *otmp;
"Only Amiga makes it possible.",
"CATS have all the answers.",
#endif
"This mail complies with the Yendorian Anti-Spam Act (YASA)",
"Please find enclosed a small token to represent your Owlbear",
"**FR33 P0T10N 0F FULL H34L1NG**",
"Please return to sender (Asmodeus)",
"Buy a potion of gain level for only $19.99! Guaranteed to be blessed!",
"Invitation: Visit the NetHack web site at http://www.nethack.org!"
};
+1 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 makemon.c $NHDT-Date: 1426465436 2015/03/16 00:23:56 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.74 $ */
/* NetHack 3.5 makemon.c $NHDT-Date: 1427440865 2015/03/27 07:21:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.75 $ */
/* NetHack 3.5 makemon.c $Date: 2012/01/29 00:34:33 $ $Revision: 1.69 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1884,10 +1884,6 @@ int *seencount; /* secondary output */
} while (--creatcnt > 0);
if (seecount) {
if (seencount) *seencount += seecount;
/* don't set contents-known flag if we just used last charge
(such suppression doesn't actually gain us much since
player can now deduce that the bag has become empty) */
if (bag->spe > 0) bag->cknown = 1;
if (bag->dknown) makeknown(BAG_OF_TRICKS);
} else if (!tipping) {
pline1(!moncount ? nothing_happens : "Nothing seems to happen.");
+2
View File
@@ -634,12 +634,14 @@ int spellnum;
if (multi >= 0)
You("stiffen briefly.");
nomul(-1);
multi_reason = "paralyzed by a monster";
} else {
if (multi >= 0)
You("are frozen in place!");
dmg = 4 + (int)mtmp->m_lev;
if (Half_spell_damage) dmg = (dmg + 1) / 2;
nomul(-dmg);
multi_reason = "paralyzed by a monster";
}
nomovemsg = 0;
dmg = 0;
+1
View File
@@ -1053,6 +1053,7 @@ dopois:
else You("are frozen by %s!", mon_nam(mtmp));
nomovemsg = You_can_move_again;
nomul(-rnd(10));
multi_reason = "paralyzed by a monster";
exercise(A_DEX, FALSE);
}
}
+169 -140
View File
@@ -344,7 +344,8 @@ fixup_special()
was_waterlevel = FALSE;
u.uinwater = 0;
unsetup_waterlevel();
} else if (Is_waterlevel(&u.uz)) {
}
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) {
level.flags.hero_memory = 0;
was_waterlevel = TRUE;
/* water level is an odd beast - it has to be set up
@@ -916,98 +917,110 @@ movebubbles()
struct trap *btrap;
static const struct rm water_pos =
{ cmap_to_glyph(S_water), WATER, 0, 0, 0, 0, 0, 0, 0 };
static const struct rm air_pos =
{ cmap_to_glyph(S_cloud), AIR, 0, 0, 0, 1, 0, 0, 0 };
/* set up the portal the first time bubbles are moved */
if (!wportal) set_wportal();
vision_recalc(2);
/* keep attached ball&chain separate from bubble objects */
if (Punished) unplacebc();
/*
* Pick up everything inside of a bubble then fill all bubble
* locations.
*/
if (Is_waterlevel(&u.uz)) {
for (b = up ? bbubbles : ebubbles; b; b = up ? b->next : b->prev) {
if (b->cons) panic("movebubbles: cons != null");
for (i = 0, x = b->x; i < (int) b->bm[0]; i++, x++)
for (j = 0, y = b->y; j < (int) b->bm[1]; j++, y++)
if (b->bm[j + 2] & (1 << i)) {
if (!isok(x,y)) {
impossible("movebubbles: bad pos (%d,%d)", x,y);
continue;
}
/* keep attached ball&chain separate from bubble objects */
if (Punished) unplacebc();
/* pick up objects, monsters, hero, and traps */
if (OBJ_AT(x,y)) {
struct obj *olist = (struct obj *) 0, *otmp;
struct container *cons = (struct container *)
alloc(sizeof(struct container));
/*
* Pick up everything inside of a bubble then fill all bubble
* locations.
*/
while ((otmp = level.objects[x][y]) != 0) {
remove_object(otmp);
otmp->ox = otmp->oy = 0;
otmp->nexthere = olist;
olist = otmp;
for (b = up ? bbubbles : ebubbles; b; b = up ? b->next : b->prev) {
if (b->cons) panic("movebubbles: cons != null");
for (i = 0, x = b->x; i < (int) b->bm[0]; i++, x++)
for (j = 0, y = b->y; j < (int) b->bm[1]; j++, y++)
if (b->bm[j + 2] & (1 << i)) {
if (!isok(x,y)) {
impossible("movebubbles: bad pos (%d,%d)", x,y);
continue;
}
cons->x = x;
cons->y = y;
cons->what = CONS_OBJ;
cons->list = (genericptr_t) olist;
cons->next = b->cons;
b->cons = cons;
/* pick up objects, monsters, hero, and traps */
if (OBJ_AT(x,y)) {
struct obj *olist = (struct obj *) 0, *otmp;
struct container *cons = (struct container *)
alloc(sizeof(struct container));
while ((otmp = level.objects[x][y]) != 0) {
remove_object(otmp);
otmp->ox = otmp->oy = 0;
otmp->nexthere = olist;
olist = otmp;
}
cons->x = x;
cons->y = y;
cons->what = CONS_OBJ;
cons->list = (genericptr_t) olist;
cons->next = b->cons;
b->cons = cons;
}
if (MON_AT(x,y)) {
struct monst *mon = m_at(x,y);
struct container *cons = (struct container *)
alloc(sizeof(struct container));
cons->x = x;
cons->y = y;
cons->what = CONS_MON;
cons->list = (genericptr_t) mon;
cons->next = b->cons;
b->cons = cons;
if(mon->wormno)
remove_worm(mon);
else
remove_monster(x, y);
newsym(x,y); /* clean up old position */
mon->mx = mon->my = 0;
}
if (!u.uswallow && x == u.ux && y == u.uy) {
struct container *cons = (struct container *)
alloc(sizeof(struct container));
cons->x = x;
cons->y = y;
cons->what = CONS_HERO;
cons->list = (genericptr_t) 0;
cons->next = b->cons;
b->cons = cons;
}
if ((btrap = t_at(x,y)) != 0) {
struct container *cons = (struct container *)
alloc(sizeof(struct container));
cons->x = x;
cons->y = y;
cons->what = CONS_TRAP;
cons->list = (genericptr_t) btrap;
cons->next = b->cons;
b->cons = cons;
}
levl[x][y] = water_pos;
block_point(x,y);
}
if (MON_AT(x,y)) {
struct monst *mon = m_at(x,y);
struct container *cons = (struct container *)
alloc(sizeof(struct container));
cons->x = x;
cons->y = y;
cons->what = CONS_MON;
cons->list = (genericptr_t) mon;
cons->next = b->cons;
b->cons = cons;
if(mon->wormno)
remove_worm(mon);
else
remove_monster(x, y);
newsym(x,y); /* clean up old position */
mon->mx = mon->my = 0;
}
if (!u.uswallow && x == u.ux && y == u.uy) {
struct container *cons = (struct container *)
alloc(sizeof(struct container));
cons->x = x;
cons->y = y;
cons->what = CONS_HERO;
cons->list = (genericptr_t) 0;
cons->next = b->cons;
b->cons = cons;
}
if ((btrap = t_at(x,y)) != 0) {
struct container *cons = (struct container *)
alloc(sizeof(struct container));
cons->x = x;
cons->y = y;
cons->what = CONS_TRAP;
cons->list = (genericptr_t) btrap;
cons->next = b->cons;
b->cons = cons;
}
levl[x][y] = water_pos;
block_point(x,y);
}
}
} else if (Is_airlevel(&u.uz)) {
for (x = 0; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) {
levl[x][y] = air_pos;
unblock_point(x,y);
}
}
/*
@@ -1026,7 +1039,7 @@ movebubbles()
}
/* put attached ball&chain back */
if (Punished) placebc();
if (Is_waterlevel(&u.uz) && Punished) placebc();
vision_full_recalc = 1;
}
@@ -1070,7 +1083,7 @@ int fd, mode;
{
register struct bubble *b;
if (!Is_waterlevel(&u.uz)) return;
if (!Is_waterlevel(&u.uz) && !Is_airlevel(&u.uz)) return;
if (perform_bwrite(mode)) {
int n = 0;
@@ -1095,7 +1108,7 @@ register int fd;
register int i;
int n;
if (!Is_waterlevel(&u.uz)) return;
if (!Is_waterlevel(&u.uz) && !Is_airlevel(&u.uz)) return;
set_wportal();
mread(fd,(genericptr_t)&n,sizeof(int));
@@ -1171,6 +1184,7 @@ setup_waterlevel()
register int x, y;
register int xskip, yskip;
register int water_glyph = cmap_to_glyph(S_water);
register int air_glyph = cmap_to_glyph(S_air);
/* ouch, hardcoded... */
@@ -1183,12 +1197,18 @@ setup_waterlevel()
for (x = xmin; x <= xmax; x++)
for (y = ymin; y <= ymax; y++)
levl[x][y].glyph = water_glyph;
levl[x][y].glyph = Is_waterlevel(&u.uz) ? water_glyph : air_glyph;
/* make bubbles */
xskip = 10 + rn2(10);
yskip = 4 + rn2(4);
if (Is_waterlevel(&u.uz)) {
xskip = 10 + rn2(10);
yskip = 4 + rn2(4);
} else {
xskip = 6 + rn2(4);
yskip = 3 + rn2(3);
}
for (x = bxmin; x <= bxmax; x += xskip)
for (y = bymin; y <= bymax; y += yskip)
mk_bubble(x,y,rn2(7));
@@ -1274,67 +1294,76 @@ register boolean ini;
register int x, y, i, j, colli = 0;
struct container *cons, *ctemp;
/* move bubble */
if (dx < -1 || dx > 1 || dy < -1 || dy > 1) {
/* pline("mv_bubble: dx = %d, dy = %d", dx, dy); */
dx = sgn(dx);
dy = sgn(dy);
/* clouds move slowly */
if (!Is_airlevel(&u.uz) || !rn2(6)) {
/* move bubble */
if (dx < -1 || dx > 1 || dy < -1 || dy > 1) {
/* pline("mv_bubble: dx = %d, dy = %d", dx, dy); */
dx = sgn(dx);
dy = sgn(dy);
}
/*
* collision with level borders?
* 1 = horizontal border, 2 = vertical, 3 = corner
*/
if (b->x <= bxmin) colli |= 2;
if (b->y <= bymin) colli |= 1;
if ((int) (b->x + b->bm[0] - 1) >= bxmax) colli |= 2;
if ((int) (b->y + b->bm[1] - 1) >= bymax) colli |= 1;
if (b->x < bxmin) {
pline("bubble xmin: x = %d, xmin = %d", b->x, bxmin);
b->x = bxmin;
}
if (b->y < bymin) {
pline("bubble ymin: y = %d, ymin = %d", b->y, bymin);
b->y = bymin;
}
if ((int) (b->x + b->bm[0] - 1) > bxmax) {
pline("bubble xmax: x = %d, xmax = %d",
b->x + b->bm[0] - 1, bxmax);
b->x = bxmax - b->bm[0] + 1;
}
if ((int) (b->y + b->bm[1] - 1) > bymax) {
pline("bubble ymax: y = %d, ymax = %d",
b->y + b->bm[1] - 1, bymax);
b->y = bymax - b->bm[1] + 1;
}
/* bounce if we're trying to move off the border */
if (b->x == bxmin && dx < 0) dx = -dx;
if (b->x + b->bm[0] - 1 == bxmax && dx > 0) dx = -dx;
if (b->y == bymin && dy < 0) dy = -dy;
if (b->y + b->bm[1] - 1 == bymax && dy > 0) dy = -dy;
b->x += dx;
b->y += dy;
}
/*
* collision with level borders?
* 1 = horizontal border, 2 = vertical, 3 = corner
*/
if (b->x <= bxmin) colli |= 2;
if (b->y <= bymin) colli |= 1;
if ((int) (b->x + b->bm[0] - 1) >= bxmax) colli |= 2;
if ((int) (b->y + b->bm[1] - 1) >= bymax) colli |= 1;
if (b->x < bxmin) {
pline("bubble xmin: x = %d, xmin = %d", b->x, bxmin);
b->x = bxmin;
}
if (b->y < bymin) {
pline("bubble ymin: y = %d, ymin = %d", b->y, bymin);
b->y = bymin;
}
if ((int) (b->x + b->bm[0] - 1) > bxmax) {
pline("bubble xmax: x = %d, xmax = %d",
b->x + b->bm[0] - 1, bxmax);
b->x = bxmax - b->bm[0] + 1;
}
if ((int) (b->y + b->bm[1] - 1) > bymax) {
pline("bubble ymax: y = %d, ymax = %d",
b->y + b->bm[1] - 1, bymax);
b->y = bymax - b->bm[1] + 1;
}
/* bounce if we're trying to move off the border */
if (b->x == bxmin && dx < 0) dx = -dx;
if (b->x + b->bm[0] - 1 == bxmax && dx > 0) dx = -dx;
if (b->y == bymin && dy < 0) dy = -dy;
if (b->y + b->bm[1] - 1 == bymax && dy > 0) dy = -dy;
b->x += dx;
b->y += dy;
/* void positions inside bubble */
/* draw the bubbles */
for (i = 0, x = b->x; i < (int) b->bm[0]; i++, x++)
for (j = 0, y = b->y; j < (int) b->bm[1]; j++, y++)
if (b->bm[j + 2] & (1 << i)) {
if (Is_waterlevel(&u.uz)) {
levl[x][y].typ = AIR;
levl[x][y].lit = 1;
unblock_point(x,y);
} else if (Is_airlevel(&u.uz)) {
levl[x][y].typ = CLOUD;
levl[x][y].lit = 1;
block_point(x,y);
}
}
/* replace contents of bubble */
for (cons = b->cons; cons; cons = ctemp) {
ctemp = cons->next;
cons->x += dx;
cons->y += dy;
if (Is_waterlevel(&u.uz)) {
/* replace contents of bubble */
for (cons = b->cons; cons; cons = ctemp) {
ctemp = cons->next;
cons->x += dx;
cons->y += dy;
switch(cons->what) {
switch(cons->what) {
case CONS_OBJ: {
struct obj *olist, *otmp;
@@ -1375,13 +1404,13 @@ register boolean ini;
default:
impossible("mv_bubble: unknown bubble contents");
break;
}
free((genericptr_t)cons);
}
free((genericptr_t)cons);
b->cons = 0;
}
b->cons = 0;
/* boing? */
switch (colli) {
case 1: b->dy = -b->dy; break;
case 3: b->dy = -b->dy; /* fall through */
+13 -9
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 mkroom.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 mkroom.c $NHDT-Date: 1427239202 2015/03/24 23:20:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.16 $ */
/* NetHack 3.5 mkroom.c $Date: 2012/01/10 17:47:19 $ $Revision: 1.15 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -219,14 +219,10 @@ struct mkroom *sroom;
{
struct monst *mon;
register int sx,sy,i;
int sh, tx, ty, goldlim, type = sroom->rtype;
int sh, tx = 0, ty = 0, goldlim = 0, type = sroom->rtype;
int rmno = (int)((sroom - rooms) + ROOMOFFSET);
coord mm;
#ifdef GCC_WARN
tx = ty = goldlim = 0;
#endif
sh = sroom->fdoor;
switch(type) {
case COURT:
@@ -408,9 +404,17 @@ morguemon()
{
register int i = rn2(100), hd = rn2(level_difficulty());
if(hd > 10 && i < 10)
return((Inhell || In_endgame(&u.uz)) ? mkclass(S_DEMON,0) :
&mons[ndemon(A_NONE)]);
if(hd > 10 && i < 10) {
if (Inhell || In_endgame(&u.uz)) {
return(mkclass(S_DEMON,0));
} else {
int ndemon_res = ndemon(A_NONE);
if (ndemon_res != NON_PM)
return(&mons[ndemon_res]);
/* else do what? As is, it will drop to ghost/wraith/zombie */
}
}
if(hd > 8 && i > 85)
return(mkclass(S_VAMPIRE,0));
+8 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 mon.c $NHDT-Date: 1426465438 2015/03/16 00:23:58 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.139 $ */
/* NetHack 3.5 mon.c $NHDT-Date: 1427580482 2015/03/28 22:08:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.142 $ */
/* NetHack 3.5 mon.c $Date: 2012/05/16 02:15:10 $ $Revision: 1.126 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -616,7 +616,10 @@ meatmetal(mtmp)
/* Eats topmost metal object if it is there */
for (otmp = level.objects[mtmp->mx][mtmp->my];
otmp; otmp = otmp->nexthere) {
if (mtmp->data == &mons[PM_RUST_MONSTER] && !is_rustprone(otmp))
/* Don't eat indigestible/choking/inappropriate objects */
if ((mtmp->data == &mons[PM_RUST_MONSTER] && !is_rustprone(otmp)) ||
(otmp->otyp == AMULET_OF_STRANGULATION) ||
(otmp->otyp == RIN_SLOW_DIGESTION))
continue;
if (is_metallic(otmp) && !obj_resists(otmp, 5, 95) &&
touch_artifact(otmp,mtmp)) {
@@ -633,9 +636,7 @@ meatmetal(mtmp)
pline("%s spits %s out in disgust!",
Monnam(mtmp), distant_name(otmp,doname));
}
/* KMH -- Don't eat indigestible/choking objects */
} else if (otmp->otyp != AMULET_OF_STRANGULATION &&
otmp->otyp != RIN_SLOW_DIGESTION) {
} else {
if (cansee(mtmp->mx,mtmp->my) && flags.verbose)
pline("%s eats %s!", Monnam(mtmp),
distant_name(otmp,doname));
@@ -1238,6 +1239,8 @@ dmonsfree()
for (mtmp = &fmon; *mtmp;) {
freetmp = *mtmp;
if (freetmp->mhp <= 0 && !freetmp->isgd) {
if (freetmp == context.polearm.hitmon)
context.polearm.hitmon = NULL;
*mtmp = freetmp->nmon;
dealloc_monst(freetmp);
count++;
+4 -4
View File
@@ -446,7 +446,7 @@ dodiscovered() /* free after Robert Viduya */
if ((dis = disco[i]) != 0 && interesting_to_discover(dis)) {
ct++;
if (oclass != prev_class) {
putstr(tmpwin, iflags.menu_headings, let_to_name(oclass, FALSE));
putstr(tmpwin, iflags.menu_headings, let_to_name(oclass, FALSE, FALSE));
prev_class = oclass;
}
Sprintf(buf, "%s %s",(objects[dis].oc_pre_discovered ? "*" : " "),
@@ -472,7 +472,7 @@ char *buf;
{
char *s;
Strcpy(buf, let_to_name(oclass, FALSE));
Strcpy(buf, let_to_name(oclass, FALSE, FALSE));
for (s = buf; *s; ++s) *s = lowc(*s);
return buf;
}
@@ -615,7 +615,7 @@ doclassdisco()
break;
default:
oclass = def_char_to_objclass(c);
Sprintf(buf, "Discovered %s", let_to_name(oclass, FALSE));
Sprintf(buf, "Discovered %s", let_to_name(oclass, FALSE, FALSE));
putstr(tmpwin, iflags.menu_headings, buf);
for (i = bases[(int)oclass];
i < NUM_OBJECTS && objects[i].oc_class == oclass; ++i) {
@@ -672,7 +672,7 @@ rename_disco()
if (oclass != prev_class) {
any.a_int = 0;
add_menu(tmpwin, NO_GLYPH, &any, ' ', iflags.menu_headings,
ATR_NONE, let_to_name(oclass, FALSE), MENU_UNSELECTED);
ATR_NONE, let_to_name(oclass, FALSE, FALSE), MENU_UNSELECTED);
prev_class = oclass;
}
any.a_int = dis;
+18 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 objnam.c $NHDT-Date: 1426977394 2015/03/21 22:36:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.108 $ */
/* NetHack 3.5 objnam.c $NHDT-Date: 1427440866 2015/03/27 07:21:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.109 $ */
/* NetHack 3.5 objnam.c $Date: 2011/10/27 02:24:54 $ $Revision: 1.101 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -489,6 +489,11 @@ register struct obj *obj;
}
if (pluralize) Strcpy(buf, makeplural(buf));
if (obj->otyp == T_SHIRT && program_state.gameover) {
char tmpbuf[BUFSZ];
Sprintf(eos(buf), " with text \"%s\"", tshirt_text(obj, tmpbuf));
}
if (has_oname(obj) && dknown) {
Strcat(buf, " named ");
nameit:
@@ -651,8 +656,9 @@ register struct obj *obj;
*/
register char *bp = xname(obj);
if (iflags.override_ID) known = cknown = bknown = lknown = TRUE;
else {
if (iflags.override_ID) {
known = cknown = bknown = lknown = TRUE;
} else {
known = obj->known;
cknown = obj->cknown;
bknown = obj->bknown;
@@ -685,7 +691,15 @@ register struct obj *obj;
/* "empty" goes at the beginning, but item count goes at the end */
if (cknown &&
(Is_container(obj) || obj->otyp == STATUE) && !Has_contents(obj))
/* bag of tricks: include "empty" prefix if it's known to
be empty but its precise number of charges isn't known
(when that is known, suffix of "(n:0)" will be appended,
making the prefix be redundant; note that 'known' flag
isn't set when emptiness gets discovered because then
charging magic would yield known number of new charges) */
(obj->otyp == BAG_OF_TRICKS ? (obj->spe == 0 && !obj->known) :
/* not bag of tricks: empty if container which has no contents */
(Is_container(obj) || obj->otyp == STATUE) && !Has_contents(obj)))
Strcat(prefix, "empty ");
if (bknown &&
+6
View File
@@ -85,6 +85,7 @@ static struct Bool_Opt
#else
{"BIOS", (boolean *)0, FALSE, SET_IN_FILE},
#endif
{"blind", &u.uroleplay.blind, FALSE, DISP_IN_GAME},
{"bones", &flags.bones, TRUE, SET_IN_FILE},
#ifdef INSURANCE
{"checkpoint", &flags.ins_chkpt, TRUE, SET_IN_GAME},
@@ -139,14 +140,17 @@ static struct Bool_Opt
#else
{"mail", (boolean *)0, TRUE, SET_IN_FILE},
#endif
{"mention_walls", &iflags.mention_walls, FALSE, SET_IN_GAME},
/* for menu debugging only*/
{"menu_tab_sep", &iflags.menu_tab_sep, FALSE, SET_IN_GAME},
{"menu_objsyms", &iflags.menu_head_objsym, FALSE, SET_IN_GAME},
{"mouse_support", &iflags.wc_mouse_support, TRUE, DISP_IN_GAME}, /*WC*/
#ifdef NEWS
{"news", &iflags.news, TRUE, DISP_IN_GAME},
#else
{"news", (boolean *)0, FALSE, SET_IN_FILE},
#endif
{"nudist", &u.uroleplay.nudist, FALSE, DISP_IN_GAME},
{"null", &flags.null, TRUE, SET_IN_GAME},
#if defined(SYSFLAGS) && defined(MAC)
{"page_wait", &sysflags.page_wait, TRUE, SET_IN_GAME},
@@ -199,6 +203,7 @@ static struct Bool_Opt
{"tombstone",&flags.tombstone, TRUE, SET_IN_GAME},
{"toptenwin",&iflags.toptenwin, FALSE, SET_IN_GAME},
{"travel", &flags.travelcmd, TRUE, SET_IN_GAME},
{"use_darkgray", &iflags.wc2_darkgray, TRUE, SET_IN_FILE},
#ifdef WIN32CON
{"use_inverse", &iflags.wc_inverse, TRUE, SET_IN_GAME}, /*WC*/
#else
@@ -4396,6 +4401,7 @@ struct wc_Opt wc2_options[] = {
{"fullscreen", WC2_FULLSCREEN},
{"softkeyboard", WC2_SOFTKEYBOARD},
{"wraptext", WC2_WRAPTEXT},
{"use_darkgray", WC2_DARKGRAY},
#ifdef STATUS_VIA_WINDOWPORT
{"hilite_status", WC2_HILITE_STATUS},
#endif
+63 -19
View File
@@ -447,7 +447,8 @@ const char **firstmatch;
{
boolean need_to_look = FALSE;
int glyph;
char look_buf[BUFSZ], prefix[BUFSZ];
static char look_buf[BUFSZ];
char prefix[BUFSZ];
int found = 0; /* count of matching syms found */
int i;
int skipped_venom = 0;
@@ -678,7 +679,7 @@ do_look(mode, click_cc)
char out_str[BUFSZ];
const char *firstmatch = 0;
struct permonst *pm = 0;
int i, ans = 0;
int i = '\0', ans = 0;
int sym; /* typed symbol or converted glyph */
int found; /* count of matching syms found */
coord cc; /* screen pos of unknown glyph */
@@ -688,25 +689,68 @@ do_look(mode, click_cc)
if (!clicklook) {
if (quick) {
from_screen = TRUE; /* yes, we want to use the cursor */
} else {
i = ynq("Specify unknown object by cursor?");
if (i == 'q') return 0;
from_screen = (i == 'y');
i = 'y';
}
if (i != 'y') {
menu_item *pick_list = (menu_item *)0;
winid win;
anything any;
win = create_nhwindow(NHW_MENU);
start_menu(win);
any.a_void = 0; any.a_char ='a';
/* 'y' and 'n' to keep backwards compat with previous versions */
add_menu(win, NO_GLYPH, &any, 'a', 'y', ATR_NONE, "something on the map", MENU_UNSELECTED);
any.a_void = 0; any.a_char ='b';
add_menu(win, NO_GLYPH, &any, 'b', 0, ATR_NONE, "something you're carrying", MENU_UNSELECTED);
any.a_void = 0; any.a_char ='c';
add_menu(win, NO_GLYPH, &any, 'c', 'n', ATR_NONE, "something else", MENU_UNSELECTED);
end_menu(win, "What do you want to look at:");
if (select_menu(win, PICK_ONE, &pick_list) > 0) {
i = pick_list->item.a_char;
free((genericptr_t)pick_list);
}
destroy_nhwindow(win);
}
if (from_screen) {
cc.x = u.ux;
cc.y = u.uy;
sym = 0; /* gcc -Wall lint */
} else {
getlin("Specify what? (type the word)", out_str);
if (out_str[0] == '\0' || out_str[0] == '\033')
return 0;
if (out_str[1]) { /* user typed in a complete string */
checkfile(out_str, pm, TRUE, TRUE);
return 0;
}
sym = out_str[0];
switch (i) {
default:
case 'q': return 0;
case 'y':
case 'a':
from_screen = TRUE;
sym = 0;
cc.x = u.ux;
cc.y = u.uy;
break;
case 'b':
{
char invlet;
struct obj *invobj;
invlet = display_inventory(NULL, TRUE);
if (!invlet) return 0;
for (invobj = invent; invobj; invobj = invobj->nobj)
if (invobj->invlet == invlet) {
strcpy(out_str, singular(invobj, xname));
break;
}
if (!out_str[1]) return 0;
checkfile(out_str, pm, TRUE, TRUE);
return 0;
}
break;
case 'c':
from_screen = FALSE;
getlin("Specify what? (type the word)", out_str);
if (out_str[0] == '\0' || out_str[0] == '\033')
return 0;
if (out_str[1]) { /* user typed in a complete string */
checkfile(out_str, pm, TRUE, TRUE);
return 0;
}
sym = out_str[0];
break;
}
} else { /* clicklook */
cc.x = click_cc->x;
+11 -8
View File
@@ -769,7 +769,9 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
if (sorted && !printed_type_name) {
any = zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
let_to_name(*pack, FALSE), MENU_UNSELECTED);
let_to_name(*pack, FALSE,
(how != PICK_NONE) && iflags.menu_head_objsym),
MENU_UNSELECTED);
printed_type_name = TRUE;
}
@@ -928,8 +930,10 @@ int how; /* type of query */
any.a_int = curr->oclass;
add_menu(win, NO_GLYPH, &any, invlet++,
def_oc_syms[(int)objects[curr->otyp].oc_class].sym,
ATR_NONE, let_to_name(*pack, FALSE),
MENU_UNSELECTED);
ATR_NONE,
let_to_name(*pack, FALSE,
(how != PICK_NONE) && iflags.menu_head_objsym),
MENU_UNSELECTED);
collected_type_name = TRUE;
}
}
@@ -1494,6 +1498,7 @@ doloot() /* loot a container on the floor or loot saddle from mon. */
char qbuf[BUFSZ];
int prev_inquiry = 0;
boolean prev_loot = FALSE;
int num_conts;
if (check_capacity((char *)0)) {
/* "Can't do that while carrying so much stuff." */
@@ -1514,15 +1519,11 @@ doloot() /* loot a container on the floor or loot saddle from mon. */
lootcont:
if (container_at(cc.x, cc.y, FALSE)) {
if ((num_conts = container_at(cc.x, cc.y, TRUE)) > 0) {
boolean anyfound = FALSE;
int num_conts = 0;
if (!able_to_loot(cc.x, cc.y, TRUE)) return 0;
for (cobj = level.objects[cc.x][cc.y]; cobj; cobj = cobj->nexthere)
if (Is_container(cobj)) num_conts++;
if (num_conts > 1) {
/* use a menu to loot many containers */
int n, i;
@@ -2120,6 +2121,7 @@ int held;
/* even if the trap fails, you've used up this turn */
if (multi >= 0) { /* in case we didn't become paralyzed */
nomul(-1);
multi_reason = "opening a container";
nomovemsg = "";
}
return 1;
@@ -2629,6 +2631,7 @@ struct obj *box; /* or bag */
/* even if the trap fails, you've used up this turn */
if (multi >= 0) { /* in case we didn't become paralyzed */
nomul(-1);
multi_reason = "tipping a container";
nomovemsg = "";
}
} else if (box->otyp == BAG_OF_TRICKS || box->otyp == HORN_OF_PLENTY) {
+1
View File
@@ -1285,6 +1285,7 @@ dogaze()
-d((int)mtmp->m_lev+1,
(int)mtmp->data->mattk[0].damd)
: -200);
multi_reason = "frozen by a monster's gaze";
nomovemsg = 0;
return 1;
} else
+5 -3
View File
@@ -375,6 +375,7 @@ ghost_from_bottle()
if(flags.verbose)
You("are frightened to death, and unable to move.");
nomul(-3);
multi_reason = "being frightened to death";
nomovemsg = "You regain your composure.";
}
@@ -678,6 +679,7 @@ peffects(otmp)
Your("%s are frozen to the %s!",
makeplural(body_part(FOOT)), surface(u.ux, u.uy));
nomul(-(rn1(10, 25 - 12*bcsign(otmp))));
multi_reason = "frozen by a potion";
nomovemsg = You_can_move_again;
exercise(A_DEX, FALSE);
}
@@ -1053,7 +1055,7 @@ boolean useeit;
const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */
{
void FDECL((*func), (OBJ_P)) = 0;
const char *how = 0, *glowcolor = 0;
const char *glowcolor = 0;
#define COST_alter (-2)
#define COST_none (-1)
int costchange = COST_none;
@@ -1062,7 +1064,6 @@ const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */
if (!potion || potion->otyp != POT_WATER) return FALSE;
if (potion->blessed) {
how = "softly glow";
if (targobj->cursed) {
func = uncurse;
glowcolor = NH_AMBER;
@@ -1074,7 +1075,6 @@ const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */
altfmt = TRUE; /* "with a <color> aura" */
}
} else if (potion->cursed) {
how = "glow";
if (targobj->blessed) {
func = unbless;
glowcolor = "brown";
@@ -1467,6 +1467,7 @@ register struct obj *obj;
if (!Free_action) {
pline("%s seems to be holding you.", Something);
nomul(-rnd(5));
multi_reason = "frozen by a potion";
nomovemsg = You_can_move_again;
exercise(A_DEX, FALSE);
} else You("stiffen momentarily.");
@@ -1476,6 +1477,7 @@ register struct obj *obj;
if (!Free_action && !Sleep_resistance) {
You_feel("rather tired.");
nomul(-rnd(5));
multi_reason = "sleeping off a magical draught";
nomovemsg = You_can_move_again;
exercise(A_DEX, FALSE);
} else You("yawn.");
+58 -11
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 pray.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 pray.c $NHDT-Date: 1427670643 2015/03/29 23:10:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.69 $ */
/* NetHack 3.5 pray.c $Date: 2012/05/07 01:44:38 $ $Revision: 1.62 $ */
/* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1269,6 +1269,7 @@ dosacrifice()
dmon->mpeaceful = TRUE;
You("are terrified, and unable to move.");
nomul(-3);
multi_reason = "being terrified of a demon";
nomovemsg = 0;
} else pline_The("%s.", demonless_msg);
}
@@ -1655,6 +1656,7 @@ dopray()
}
}
nomul(-3);
multi_reason = "praying";
nomovemsg = "You finish your prayer.";
afternmv = prayer_done;
@@ -1817,6 +1819,7 @@ doturn()
}
}
nomul(-5);
multi_reason = "trying to turn the monsters";
nomovemsg = You_can_move_again;
return(1);
}
@@ -1860,26 +1863,70 @@ aligntyp alignment;
return gnam;
}
static const char *hallu_gods[] = {
"the Flying Spaghetti Monster", /* Church of the FSM */
"Eris", /* Discordianism */
"the Martians", /* every science fiction ever */
"Xom", /* Crawl */
"AnDoR dRaKoN", /* ADOM */
"the Central Bank of Yendor", /* economics */
"Tooth Fairy", /* real world(?) */
"Om", /* Discworld */
"Yawgmoth", /* Magic: the Gathering */
"Morgoth", /* LoTR */
"Cthulhu", /* Lovecraft */
"the Ori", /* Stargate */
"destiny", /* why not? */
"your Friend the Computer", /* Paranoia */
};
/* hallucination handling for priest/minion names: select a random god
iff character is hallucinating */
const char *
halu_gname(alignment)
aligntyp alignment;
{
const char *gnam;
const char *gnam = NULL;
int which;
if (!Hallucination) return align_gname(alignment);
if (!Hallucination)
return align_gname(alignment);
which = randrole();
switch (rn2(3)) {
case 0: gnam = roles[which].lgod; break;
case 1: gnam = roles[which].ngod; break;
case 2: gnam = roles[which].cgod; break;
default: gnam = 0; break; /* lint suppression */
/* The priest may not have initialized god names. If this is the
* case, and we roll priest, we need to try again. */
do
which = randrole();
while (!roles[which].lgod);
switch (rn2(9)) {
case 0:
case 1:
gnam = roles[which].lgod;
break;
case 2:
case 3:
gnam = roles[which].ngod;
break;
case 4:
case 5:
gnam = roles[which].cgod;
break;
case 6:
case 7:
gnam = hallu_gods[rn2(sizeof hallu_gods / sizeof *hallu_gods)];
break;
case 8:
gnam = Moloch;
break;
default:
impossible("rn2 broken in halu_gname?!?");
}
if (!gnam) gnam = Moloch;
if (*gnam == '_') ++gnam;
if (!gnam) {
impossible("No random god name?");
gnam = "your Friend the Computer"; /* Paranoia */
}
if (*gnam == '_')
++gnam;
return gnam;
}
+1
View File
@@ -475,6 +475,7 @@ int roomno;
if (flags.verbose)
You("are frightened to death, and unable to move.");
nomul(-3);
multi_reason = "being terrified of a demon";
nomovemsg = "You regain your composure.";
}
}
+198 -31
View File
@@ -53,6 +53,115 @@ struct obj *sobj;
(void) learnscrolltyp(sobj->otyp);
}
char *
erode_obj_text(otmp, buf)
struct obj *otmp;
char *buf;
{
int erosion = greatest_erosion(otmp);
if (erosion)
wipeout_text(buf,
(int)(strlen(buf) * erosion / (2*MAX_ERODE)),
otmp->o_id ^ (unsigned)ubirthday);
return buf;
}
char *
tshirt_text(tshirt, buf)
struct obj *tshirt;
char *buf;
{
static const char *shirt_msgs[] = { /* Scott Bigham */
"I explored the Dungeons of Doom and all I got was this lousy T-shirt!",
"Is that Mjollnir in your pocket or are you just happy to see me?",
"It's not the size of your sword, it's how #enhance'd you are with it.",
"Madame Elvira's House O' Succubi Lifetime Customer",
"Madame Elvira's House O' Succubi Employee of the Month",
"Ludios Vault Guards Do It In Small, Dark Rooms",
"Yendor Military Soldiers Do It In Large Groups",
"I survived Yendor Military Boot Camp",
"Ludios Accounting School Intra-Mural Lacrosse Team",
"Oracle(TM) Fountains 10th Annual Wet T-Shirt Contest",
"Hey, black dragon! Disintegrate THIS!",
"I'm With Stupid -->",
"Don't blame me, I voted for Izchak!",
"Don't Panic", /* HHGTTG */
"Furinkan High School Athletic Dept.", /* Ranma 1/2 */
"Hel-LOOO, Nurse!", /* Animaniacs */
"=^.^=",
"100% goblin hair - do not wash",
"Aberzombie and Fitch",
"cK -- Cockatrice touches the Kop",
"Don't ask me, I only adventure here",
"Down with pants!",
"d, your dog or a killer?",
"FREE PUG AND NEWT!",
"Go team ant!",
"Got newt?",
"Hello, my darlings!", /* Charlie Drake */
"Hey! Nymphs! Steal This T-Shirt!",
"I <3 Dungeon of Doom",
"I <3 Maud",
"I am a Valkyrie. If you see me running, try to keep up.",
"I am not a pack rat - I am a collector",
"I bounced off a rubber tree", /* Monkey Island */
"Plunder Island Brimstone Beach Club", /* Monkey Island */
"If you can read this, I can hit you with my polearm",
"I'm confused!",
"I scored with the princess",
"I want to live forever or die in the attempt.",
"Lichen Park",
"LOST IN THOUGHT - please send search party",
"Meat is Mordor",
"Minetown Better Business Bureau",
"Minetown Watch",
"Ms. Palm's House of Negotiable Affection -- A Very Reputable House Of Disrepute",
"Protection Racketeer",
"Real men love Crom",
"Somebody stole my Mojo!",
"The Hellhound Gang",
"The Werewolves",
"They Might Be Storm Giants",
"Weapons don't kill people, I kill people",
"White Zombie",
"You're killing me!",
"Anhur State University - Home of the Fighting Fire Ants!",
"FREE HUGS",
"Serial Ascender",
"Real men are valkyries",
"Young Men's Cavedigging Association",
"Occupy Fort Ludios",
"I couldn't afford this T-shirt so I stole it!",
"Mind flayers suck",
"I'm not wearing any pants",
"Down with the living!",
"Pudding farmer",
"Vegetarian",
};
Strcpy(buf, shirt_msgs[tshirt->o_id % SIZE(shirt_msgs)]);
return erode_obj_text(tshirt, buf);
}
char *
apron_text(apron, buf)
struct obj *apron;
char *buf;
{
static const char *apron_msgs[] = {
"Kiss the cook",
"I'm making SCIENCE!",
"Don't mess with the chef",
"Don't make me poison you",
"Gehennom's Kitchen",
"Rat: The other white meat",
"If you can't stand the heat, get out of Gehennom!",
"If we weren't meant to eat animals, why are they made out of meat?",
"If you don't like the food, I'll stab you",
};
Strcpy(buf, apron_msgs[apron->o_id % SIZE(apron_msgs)]);
return erode_obj_text(apron, buf);
}
int
doread()
{
@@ -72,34 +181,15 @@ doread()
if (!Blind) u.uconduct.literate++;
useup(scroll);
return(1);
} else if (scroll->otyp == T_SHIRT) {
static const char *shirt_msgs[] = { /* Scott Bigham */
"I explored the Dungeons of Doom and all I got was this lousy T-shirt!",
"Is that Mjollnir in your pocket or are you just happy to see me?",
"It's not the size of your sword, it's how #enhance'd you are with it.",
"Madame Elvira's House O' Succubi Lifetime Customer",
"Madame Elvira's House O' Succubi Employee of the Month",
"Ludios Vault Guards Do It In Small, Dark Rooms",
"Yendor Military Soldiers Do It In Large Groups",
"I survived Yendor Military Boot Camp",
"Ludios Accounting School Intra-Mural Lacrosse Team",
"Oracle(TM) Fountains 10th Annual Wet T-Shirt Contest",
"Hey, black dragon! Disintegrate THIS!",
"I'm With Stupid -->",
"Don't blame me, I voted for Izchak!",
"Don't Panic", /* HHGTTG */
"Furinkan High School Athletic Dept.", /* Ranma 1/2 */
"Hel-LOOO, Nurse!", /* Animaniacs */
};
} else if (scroll->otyp == T_SHIRT ||
scroll->otyp == ALCHEMY_SMOCK) {
char buf[BUFSZ];
int erosion;
if (Blind) {
You_cant("feel any Braille writing.");
return 0;
}
/* can't read shirt worn under suit (under cloak is ok though) */
if (uarm && scroll == uarmu) {
if (scroll->otyp == T_SHIRT && uarm && scroll == uarmu) {
pline("%s shirt is obscured by %s%s.",
scroll->unpaid ? "That" : "Your",
shk_your(buf, uarm), suit_simple_name(uarm));
@@ -108,19 +198,96 @@ doread()
u.uconduct.literate++;
if(flags.verbose)
pline("It reads:");
Strcpy(buf, shirt_msgs[scroll->o_id % SIZE(shirt_msgs)]);
erosion = greatest_erosion(scroll);
if (erosion)
wipeout_text(buf,
(int)(strlen(buf) * erosion / (2*MAX_ERODE)),
scroll->o_id ^ (unsigned)ubirthday);
pline("\"%s\"", buf);
pline("\"%s\"", (scroll->otyp == T_SHIRT)
? tshirt_text(scroll, buf)
: apron_text(scroll, buf));
return 1;
} else if (scroll->otyp == CREDIT_CARD) {
static const char *card_msgs[] = {
"Leprechaun Gold Tru$t - Shamrock Card",
"Magic Memory Vault Charge Card",
"Larn National Bank", /* Larn */
"First Bank of Omega", /* Omega */
"Bank of Zork - Frobozz Magic Card", /* Zork */
"Ankh-Morpork Merchant's Guild Barter Card",
"Ankh-Morpork Thieves' Guild Unlimited Transaction Card",
"Ransmannsby Moneylenders Association",
"Bank of Gehennom - 99% Interest Card",
"Yendorian Express - Copper Card",
"Yendorian Express - Silver Card",
"Yendorian Express - Gold Card",
"Yendorian Express - Mithril Card",
"Yendorian Express - Platinum Card", /* must be last */
};
if (Blind) {
You("feel the embossed numbers:");
} else {
if(flags.verbose)
pline("It reads:");
pline("\"%s\"", scroll->oartifact ? card_msgs[SIZE(card_msgs)-1]
: card_msgs[scroll->o_id % (SIZE(card_msgs)-1)]);
}
/* Make a credit card number */
pline("\"%d0%d %d%d1 0%d%d0\"", ((scroll->o_id % 89)+10), (scroll->o_id % 4),
(((scroll->o_id * 499) % 899999) + 100000), (scroll->o_id % 10),
(!(scroll->o_id % 3)), ((scroll->o_id * 7) % 10));
u.uconduct.literate++;
return 1;
} else if (scroll->otyp == CAN_OF_GREASE) {
pline("This %s has no label.", singular(scroll, xname));
return 0;
} else if (scroll->otyp == MAGIC_MARKER) {
if (Blind) {
You_cant("feel any Braille writing.");
return 0;
}
if (flags.verbose)
pline("It reads:");
pline("\"Magic Marker(TM) Red Ink Marker Pen. Water Soluble.\"");
u.uconduct.literate++;
return 1;
} else if (scroll->oclass == COIN_CLASS) {
if (Blind)
You("feel the embossed words:");
else if (flags.verbose)
You("read:");
pline("\"1 Zorkmid. 857 GUE. In Frobs We Trust.\"");
u.uconduct.literate++;
return 1;
} else if (scroll->oartifact == ART_ORB_OF_FATE) {
if (Blind)
You("feel the engraved signature:");
else pline("It is signed:");
pline("\"Odin.\"");
u.uconduct.literate++;
return 1;
} else if (scroll->otyp == CANDY_BAR) {
static const char *wrapper_msgs[] = {
"Apollo", /* Lost */
"Moon Crunchy", /* South Park */
"Snacky Cake",
"Chocolate Nuggie",
"The Small Bar",
"Crispy Yum Yum",
"Nilla Crunchie",
"Berry Bar",
"Choco Nummer",
"Om-nom", /* Cat Macro */
"Fruity Oaty", /* Serenity */
"Wonka Bar" /* Charlie and the Chocolate Factory */
};
if (Blind) {
You_cant("feel any Braille writing.");
return 0;
}
pline("The wrapper reads: \"%s\"", wrapper_msgs[scroll->o_id % SIZE(wrapper_msgs)]);
u.uconduct.literate++;
return 1;
} else if (scroll->oclass != SCROLL_CLASS
&& scroll->oclass != SPBOOK_CLASS) {
pline(silly_thing_to, "read");
return(0);
} else if (Blind) {
} else if (Blind && (scroll->otyp != SPE_BOOK_OF_THE_DEAD)) {
const char *what = 0;
if (scroll->oclass == SPBOOK_CLASS)
what = "mystic runes";
@@ -2031,7 +2198,7 @@ create_particular()
{
char buf[BUFSZ], *bufp, monclass;
int which, tryct, i, firstchoice = NON_PM;
struct permonst *whichpm;
struct permonst *whichpm = NULL;
struct monst *mtmp;
boolean madeany = FALSE;
boolean maketame, makepeaceful, makehostile;
+7 -3
View File
@@ -446,6 +446,10 @@ boolean ghostly;
if (mtmp->isshk) restshk(mtmp, ghostly);
if (mtmp->ispriest) restpriest(mtmp, ghostly);
if (!ghostly) {
if (mtmp->m_id == context.polearm.m_id)
context.polearm.hitmon = mtmp;
}
mtmp2 = mtmp;
}
if(first && mtmp2->nmon){
@@ -1140,9 +1144,9 @@ get_plname_from_file(fd, plbuf)
int fd;
char *plbuf;
{
int rlen, pltmpsiz = 0;
rlen = read(fd, (genericptr_t) &pltmpsiz, sizeof(pltmpsiz));
rlen = read(fd, (genericptr_t) plbuf, pltmpsiz);
int pltmpsiz = 0;
(void) read(fd, (genericptr_t) &pltmpsiz, sizeof(pltmpsiz));
(void) read(fd, (genericptr_t) plbuf, pltmpsiz);
return;
}
+7 -1
View File
@@ -1124,8 +1124,13 @@ register struct monst *mtmp;
}
if (mtmp->minvent)
saveobjchn(fd,mtmp->minvent,mode);
if (release_data(mode))
if (release_data(mode)) {
if (mtmp == context.polearm.hitmon) {
context.polearm.m_id = mtmp->m_id;
context.polearm.hitmon = NULL;
}
dealloc_monst(mtmp);
}
mtmp = mtmp2;
}
if (perform_bwrite(mode))
@@ -1316,6 +1321,7 @@ freedynamicdata()
/* level-specific data */
free_timers(RANGE_LEVEL);
free_light_sources(RANGE_LEVEL);
clear_regions();
freemonchn(fmon);
free_worm(); /* release worm segment information */
freetrapchn(ftrap);
+6 -1
View File
@@ -304,7 +304,11 @@ dosounds()
static const char * const h_sounds[] = {
"beep", "boing", "sing", "belche", "creak", "cough", "rattle",
"ululate", "pop", "jingle", "sniffle", "tinkle", "eep"
"ululate", "pop", "jingle", "sniffle", "tinkle", "eep",
"clatter", "hum", "sizzle", "twitter", "wheeze", "rustle",
"honk", "lisp", "yodel", "coo", "burp", "moo", "boom",
"murmur", "oink", "quack", "rumble", "twang", "bellow",
"toot", "gargle", "hoot", "warble"
};
const char *
@@ -706,6 +710,7 @@ register struct monst *mtmp;
pline("%s rattles noisily.", Monnam(mtmp));
You("freeze for a moment.");
nomul(-2);
multi_reason = "scared by rattling";
nomovemsg = 0;
break;
case MS_LAUGH:
+3
View File
@@ -329,6 +329,7 @@ learn(VOID_ARGS)
context.spbook.book = 0; /* no longer studying */
context.spbook.o_id = 0;
nomul(context.spbook.delay); /* remaining delay is uninterrupted */
multi_reason = "reading a book";
nomovemsg = 0;
context.spbook.delay = 0;
return(0);
@@ -506,6 +507,7 @@ register struct obj *spellbook;
boolean gone = cursed_book(spellbook);
nomul(context.spbook.delay); /* study time */
multi_reason = "reading a book";
nomovemsg = 0;
context.spbook.delay = 0;
if(gone || !rn2(3)) {
@@ -522,6 +524,7 @@ register struct obj *spellbook;
spellbook->in_use = FALSE;
}
nomul(context.spbook.delay);
multi_reason = "reading a book";
nomovemsg = 0;
context.spbook.delay = 0;
return(1);
+1
View File
@@ -361,6 +361,7 @@ gotobj:
named++;
/* the following is to set multi for later on */
nomul(-armordelay);
multi_reason = "taking off clothes";
nomovemsg = 0;
remove_worn_item(otmp, TRUE);
otmp->cursed = curssv;
+1
View File
@@ -33,6 +33,7 @@ sys_early_init()
#endif
sysopt.env_dbgfl = 0; /* haven't checked getenv("DEBUGFILES") yet */
sysopt.shellers = NULL;
sysopt.explorers = NULL;
sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */
/* record file */
+4
View File
@@ -51,6 +51,7 @@ stoned_dialogue()
case 3: /* limbs turned to stone */
stop_occupation();
nomul(-3); /* can't move anymore */
multi_reason = "getting stoned";
nomovemsg = You_can_move_again; /* not unconscious */
break;
default:
@@ -377,6 +378,7 @@ nh_timeout()
if (u.umoved && !Levitation) {
slip_or_trip();
nomul(-2);
multi_reason = "fumbling";
nomovemsg = "";
/* The more you are carrying the more likely you
* are to make noise when you fumble. Adjustments
@@ -409,6 +411,7 @@ boolean wakeup_msg;
{
stop_occupation();
nomul(how_long);
multi_reason = "sleeping";
/* generally don't notice sounds while sleeping */
if (wakeup_msg && multi == how_long) {
/* caller can follow with a direct call to Hear_again() if
@@ -1271,6 +1274,7 @@ do_storms()
if(!u.uinvulnerable) {
stop_occupation();
nomul(-3);
multi_reason = "hiding from thunderstorm";
nomovemsg = 0;
}
} else
+16
View File
@@ -66,6 +66,7 @@ STATIC_DCL void FDECL(discardexcess, (FILE *));
STATIC_DCL void FDECL(readentry, (FILE *,struct toptenentry *));
STATIC_DCL void FDECL(writeentry, (FILE *,struct toptenentry *));
STATIC_DCL void FDECL(writexlentry, (FILE*, struct toptenentry *));
STATIC_DCL long NDECL(encodexlogflags);
STATIC_DCL long NDECL(encodeconduct);
STATIC_DCL long NDECL(encodeachieve);
STATIC_DCL void FDECL(free_ttlist, (struct toptenentry *));
@@ -341,10 +342,23 @@ struct toptenentry *tt;
Fprintf(rfile, "%cgender0=%s%calign0=%s",
XLOG_SEP, genders[flags.initgend].filecode,
XLOG_SEP, aligns[1 - u.ualignbase[A_ORIGINAL]].filecode);
Fprintf(rfile, "%cflags=0x%lx",
XLOG_SEP, encodexlogflags());
Fprintf(rfile, "\n");
#undef XLOG_SEP
}
STATIC_OVL long
encodexlogflags()
{
long e = 0L;
if (wizard) e |= 1L << 0;
if (discover) e |= 1L << 1;
return e;
}
STATIC_OVL long
encodeconduct()
{
@@ -383,6 +397,8 @@ encodeachieve()
if(u.uachieve.mines_luckstone) r |= 1L << 9;
if(u.uachieve.finish_sokoban) r |= 1L << 10;
if(u.uachieve.killed_medusa) r |= 1L << 11;
if(u.uroleplay.blind) r |= 1L << 12;
if(u.uroleplay.nudist) r |= 1L << 13;
return r;
}
+13 -8
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 trap.c $NHDT-Date: 1426558928 2015/03/17 02:22:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.195 $ */
/* NetHack 3.5 trap.c $NHDT-Date: 1427331767 2015/03/26 01:02:47 $ $NHDT-Branch: master $:$NHDT-Revision: 1.199 $ */
/* NetHack 3.5 trap.c $Date: 2013/03/14 01:58:21 $ $Revision: 1.179 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -946,6 +946,7 @@ unsigned trflags;
} else {
pline("%s bear trap closes on your %s!",
A_Your[trap->madeby_u], body_part(FOOT));
set_wounded_legs(rn2(2) ? RIGHT_SIDE : LEFT_SIDE, rn1(10,10));
if(u.umonnum == PM_OWLBEAR || u.umonnum == PM_BUGBEAR)
You("howl in anger!");
losehp(Maybe_Half_Phys(dmg), "bear trap", KILLED_BY_AN);
@@ -1406,13 +1407,12 @@ struct obj *otmp;
{
struct monst *steed = u.usteed;
int tt;
boolean in_sight, trapkilled, steedhit;
boolean trapkilled, steedhit;
if (!steed || !trap) return 0;
tt = trap->ttyp;
steed->mx = u.ux;
steed->my = u.uy;
in_sight = !Blind;
trapkilled = steedhit = FALSE;
switch (tt) {
@@ -3118,13 +3118,17 @@ acid_damage(obj)
struct obj *obj;
{
/* Scrolls but not spellbooks can be erased by acid. */
struct monst *victim =
carried(obj) ? &youmonst : mcarried(obj) ? obj->ocarry : NULL;
boolean vismon = victim && (victim != &youmonst) && canseemon(victim);
struct monst *victim;
boolean vismon;
if (obj->greased)
if (!obj) return;
victim = carried(obj) ? &youmonst : mcarried(obj) ? obj->ocarry : NULL;
vismon = victim && (victim != &youmonst) && canseemon(victim);
if (obj->greased) {
grease_protect(obj, NULL, victim);
else if (obj->oclass == SCROLL_CLASS && obj->otyp != SCR_BLANK_PAPER) {
} else if (obj->oclass == SCROLL_CLASS && obj->otyp != SCR_BLANK_PAPER) {
if (obj->otyp != SCR_BLANK_PAPER
#ifdef MAIL
&& obj->otyp != SCR_MAIL
@@ -4444,6 +4448,7 @@ boolean disarm;
if (!Free_action) {
pline("Suddenly you are frozen in place!");
nomul(-d(5, 6));
multi_reason = "frozen by a trap";
exercise(A_DEX, FALSE);
nomovemsg = You_can_move_again;
} else You("momentarily stiffen.");
+10
View File
@@ -491,6 +491,7 @@ void
u_init()
{
register int i;
struct u_roleplay tmpuroleplay = u.uroleplay; /* these set by rcfile options */
flags.female = flags.initgend;
flags.beginner = 1;
@@ -502,6 +503,8 @@ u_init()
(void) memset((genericptr_t)&ubirthday, 0, sizeof(ubirthday));
(void) memset((genericptr_t)&urealtime, 0, sizeof(urealtime));
u.uroleplay = tmpuroleplay; /* restore options set via rcfile */
#if 0 /* documentation of more zero values as desirable */
u.usick_cause[0] = 0;
u.uluck = u.moreluck = 0;
@@ -922,6 +925,13 @@ register struct trobj *trop;
nocreate4 = otyp;
}
/* nudist gets no armor */
if (u.uroleplay.nudist && obj->oclass == ARMOR_CLASS) {
dealloc_obj(obj);
trop++;
continue;
}
if (trop->trclass == COIN_CLASS) {
/* no "blessed" or "identified" money */
obj->quan = u.umoney0;
+3
View File
@@ -1871,6 +1871,7 @@ register struct attack *mattk;
You("digest %s.", mon_nam(mdef));
if (Slow_digestion) tmp *= 2;
nomul(-tmp);
multi_reason = "digesting something";
nomovemsg = msgbuf;
} else pline1(msgbuf);
if (pd == &mons[PM_GREEN_SLIME]) {
@@ -2353,6 +2354,7 @@ boolean wep_was_destroyed;
You("are frozen by %s gaze!",
s_suffix(mon_nam(mon)));
nomul((ACURR(A_WIS) > 12 || rn2(4)) ? -tmp : -127);
multi_reason = "frozen by a monster's gaze";
nomovemsg = 0;
}
} else {
@@ -2366,6 +2368,7 @@ boolean wep_was_destroyed;
You("are frozen by %s!", mon_nam(mon));
nomovemsg = You_can_move_again;
nomul(-tmp);
multi_reason = "frozen by a monster";
exercise(A_DEX, FALSE);
}
break;
+5 -5
View File
@@ -2198,9 +2198,9 @@ right_side(row, left, right_mark, limits)
int deeper; /* if TRUE, call self as needed */
int result; /* set by q?_path() */
register int i; /* loop counter */
register char *rowp; /* row optimization */
char *row_min; /* left most [used by macro set_min()] */
char *row_max; /* right most [used by macro set_max()] */
register char *rowp = NULL; /* row optimization */
char *row_min = NULL; /* left most [used by macro set_min()] */
char *row_max = NULL; /* right most [used by macro set_max()] */
int lim_max; /* right most limit of circle */
#ifdef GCC_WARN
@@ -2374,8 +2374,8 @@ left_side(row, left_mark, right, limits)
{
int left, left_edge, nrow, deeper, result;
register int i;
register char *rowp;
char *row_min, *row_max;
register char *rowp = NULL;
char *row_min = NULL, *row_max = NULL;
int lim_min;
#ifdef GCC_WARN
+2 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 worn.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 worn.c $NHDT-Date: 1427580338 2015/03/28 22:05:38 $ $NHDT-Branch: master $:$NHDT-Revision: 1.35 $ */
/* NetHack 3.5 worn.c $Date: 2013/11/05 00:57:56 $ $Revision: 1.32 $ */
/* SCCS Id: @(#)worn.c 3.5 2009/02/28 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
@@ -57,6 +57,7 @@ long mask;
uskin = obj;
/* assert( !uarm ); */
} else {
if ((mask & W_ARMOR)) u.uroleplay.nudist = FALSE;
for(wp = worn; wp->w_mask; wp++) if(wp->w_mask & mask) {
oobj = *(wp->w_obj);
if(oobj && !(oobj->owornmask & wp->w_mask))
@@ -591,9 +592,7 @@ long flag;
case W_ARMS: return uarms;
case W_ARMG: return uarmg;
case W_ARMF: return uarmf;
#ifdef TOURIST
case W_ARMU: return uarmu;
#endif
default:
impossible("bad flag in which_armor");
return 0;
+35 -7
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 zap.c $NHDT-Date: 1426465444 2015/03/16 00:24:04 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.195 $ */
/* NetHack 3.5 zap.c $NHDT-Date: 1427782839 2015/03/31 06:20:39 $ $NHDT-Branch: master $:$NHDT-Revision: 1.200 $ */
/* NetHack 3.5 zap.c $Date: 2013/11/05 00:57:56 $ $Revision: 1.183 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1750,8 +1750,14 @@ struct obj *obj, *otmp;
if (Is_box(obj)) (void) boxlock(obj, otmp);
if (obj_shudders(obj)) {
boolean cover = ((obj == level.objects[u.ux][u.uy]) &&
u.uundetected &&
hides_under(youmonst.data));
if (cansee(obj->ox, obj->oy)) learn_it = TRUE;
do_osshock(obj);
/* eek - your cover might have been blown */
if (cover) (void) hideunder(&youmonst);
break;
}
obj = poly_obj(obj, STRANGE_OBJECT);
@@ -1886,10 +1892,11 @@ struct obj *obj, *otmp;
/* returns nonzero if something was hit */
int
bhitpile(obj,fhito,tx,ty)
bhitpile(obj, fhito, tx, ty, zz)
struct obj *obj;
int FDECL((*fhito), (OBJ_P,OBJ_P));
int tx, ty;
schar zz;
{
int hitanything = 0;
register struct obj *otmp, *next_obj;
@@ -1909,8 +1916,11 @@ bhitpile(obj,fhito,tx,ty)
poly_zapped = -1;
for(otmp = level.objects[tx][ty]; otmp; otmp = next_obj) {
/* Fix for polymorph bug, Tim Wright */
next_obj = otmp->nexthere;
/* for zap downwards, don't hit object poly'd hero is hiding under */
if (zz > 0 && u.uundetected && otmp == level.objects[u.ux][u.uy]
&& hides_under(youmonst.data)) continue;
hitanything += (*fhito)(otmp, obj);
}
if(poly_zapped >= 0)
@@ -2562,7 +2572,7 @@ struct obj *obj; /* wand or spell */
if (u.dz < 0) {
You("probe towards the %s.", ceiling(x,y));
} else {
ptmp += bhitpile(obj, bhito, x, y);
ptmp += bhitpile(obj, bhito, x, y, u.dz);
You("probe beneath the %s.", surface(x,y));
ptmp += display_binventory(x, y, TRUE);
}
@@ -2682,7 +2692,7 @@ struct obj *obj; /* wand or spell */
if (u.dz > 0) {
/* zapping downward */
(void) bhitpile(obj, bhito, x, y);
(void) bhitpile(obj, bhito, x, y, u.dz);
/* subset of engraving effects; none sets `disclose' */
if ((e = engr_at(x, y)) != 0 && e->engr_type != HEADSTONE) {
@@ -2718,6 +2728,22 @@ struct obj *obj; /* wand or spell */
break;
}
}
} else if (u.dz < 0) {
/* zapping upward */
/* game flavor: if you're hiding under "something"
* a zap upward should hit that "something".
*/
if (u.uundetected && hides_under(youmonst.data)) {
int hitit = 0;
otmp = level.objects[u.ux][u.uy];
if (otmp) hitit = bhito(otmp, obj);
if (hitit) {
(void) hideunder(&youmonst);
disclose = TRUE;
}
}
}
return disclose;
@@ -3089,7 +3115,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
}
}
if(fhito) {
if(bhitpile(obj,fhito,bhitpos.x,bhitpos.y))
if(bhitpile(obj,fhito,bhitpos.x,bhitpos.y,0))
range--;
} else {
if(weapon == KICKED_WEAPON &&
@@ -3253,8 +3279,10 @@ int dx, dy;
}
tmp_at(bhitpos.x, bhitpos.y);
delay_output();
if(IS_SINK(levl[bhitpos.x][bhitpos.y].typ))
if(IS_SINK(levl[bhitpos.x][bhitpos.y].typ)) {
if (!Deaf) pline("Klonk!");
break; /* boomerang falls on sink */
}
/* ct==0, initial position, we want next delta to be same;
ct==5, opposite position, repeat delta undoes first one */
if (ct % 5 != 0) i += (counterclockwise ? -1 : 1);