Merge remote-tracking branch 'origin/NetHack-3.6.0'
This commit is contained in:
+7
-9
@@ -59,15 +59,12 @@ boolean resuming;
|
||||
context.rndencode = rnd(9000);
|
||||
set_wear((struct obj *) 0); /* for side-effects of starting gear */
|
||||
(void) pickup(1); /* autopickup at initial location */
|
||||
} else { /* restore old game */
|
||||
#ifndef WIN32
|
||||
update_inventory(); /* for perm_invent */
|
||||
#endif
|
||||
}
|
||||
context.botlx = TRUE; /* for STATUS_HILITES */
|
||||
update_inventory(); /* for perm_invent */
|
||||
if (resuming) { /* restoring old game */
|
||||
read_engr_at(u.ux, u.uy); /* subset of pickup() */
|
||||
}
|
||||
#ifdef WIN32
|
||||
update_inventory(); /* for perm_invent */
|
||||
#endif
|
||||
|
||||
(void) encumber_msg(); /* in case they auto-picked up something */
|
||||
if (defer_see_monsters) {
|
||||
@@ -325,6 +322,7 @@ boolean resuming;
|
||||
/* once-per-hero-took-time things go here */
|
||||
/******************************************/
|
||||
|
||||
status_eval_next_unhilite();
|
||||
if (context.bypasses)
|
||||
clear_bypasses();
|
||||
if ((u.uhave.amulet || Clairvoyant) && !In_endgame(&u.uz)
|
||||
@@ -537,7 +535,7 @@ void
|
||||
display_gamewindows()
|
||||
{
|
||||
WIN_MESSAGE = create_nhwindow(NHW_MESSAGE);
|
||||
#ifdef STATUS_VIA_WINDOWPORT
|
||||
#ifdef STATUS_HILITES
|
||||
status_initialize(0);
|
||||
#else
|
||||
WIN_STATUS = create_nhwindow(NHW_STATUS);
|
||||
@@ -561,7 +559,7 @@ display_gamewindows()
|
||||
* The mac port is not DEPENDENT on the order of these
|
||||
* displays, but it looks a lot better this way...
|
||||
*/
|
||||
#ifndef STATUS_VIA_WINDOWPORT
|
||||
#ifndef STATUS_HILITES
|
||||
display_nhwindow(WIN_STATUS, FALSE);
|
||||
#endif
|
||||
display_nhwindow(WIN_MESSAGE, FALSE);
|
||||
|
||||
+5
-3
@@ -1224,6 +1224,9 @@ struct obj **optr;
|
||||
end_burn(obj, TRUE);
|
||||
/* candles are now gone */
|
||||
useupall(obj);
|
||||
/* candelabrum's weight is changing */
|
||||
otmp->owt = weight(otmp);
|
||||
update_inventory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2786,9 +2789,8 @@ struct obj *obj;
|
||||
int hitu, hitvalu;
|
||||
|
||||
hitvalu = 8 + otmp->spe;
|
||||
hitu = thitu(hitvalu,
|
||||
dmgval(otmp, &youmonst),
|
||||
otmp, (char *)0);
|
||||
hitu = thitu(hitvalu, dmgval(otmp, &youmonst),
|
||||
&otmp, (char *)0);
|
||||
if (hitu) {
|
||||
pline_The("%s hits you as you try to snatch it!",
|
||||
the(onambuf));
|
||||
|
||||
+4
-2
@@ -610,11 +610,13 @@ drag:
|
||||
You("are jerked back by the iron ball!");
|
||||
if ((victim = m_at(uchain->ox, uchain->oy)) != 0) {
|
||||
int tmp;
|
||||
int dieroll = rnd(20);
|
||||
|
||||
tmp = -2 + Luck + find_mac(victim);
|
||||
tmp += omon_adj(victim, uball, TRUE);
|
||||
if (tmp >= rnd(20))
|
||||
(void) hmon(victim, uball, HMON_DRAGGED);
|
||||
|
||||
if (tmp >= dieroll)
|
||||
(void) hmon(victim, uball, HMON_DRAGGED, dieroll);
|
||||
else
|
||||
miss(xname(uball), victim);
|
||||
|
||||
|
||||
+2355
-752
File diff suppressed because it is too large
Load Diff
@@ -264,9 +264,7 @@ NEARDATA char **viz_array = 0; /* used in cansee() and couldsee() macros */
|
||||
|
||||
/* Global windowing data, defined here for multi-window-system support */
|
||||
NEARDATA winid WIN_MESSAGE = WIN_ERR;
|
||||
#ifndef STATUS_VIA_WINDOWPORT
|
||||
NEARDATA winid WIN_STATUS = WIN_ERR;
|
||||
#endif
|
||||
NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR;
|
||||
char toplines[TBUFSZ];
|
||||
/* Windowing stuff that's really tty oriented, but present for all ports */
|
||||
|
||||
@@ -158,7 +158,10 @@ const char *verb;
|
||||
(mtmp) ? "" : " with you");
|
||||
if (mtmp) {
|
||||
if (!passes_walls(mtmp->data) && !throws_rocks(mtmp->data)) {
|
||||
if (hmon(mtmp, obj, TRUE) && !is_whirly(mtmp->data))
|
||||
int dieroll = rnd(20);
|
||||
|
||||
if (hmon(mtmp, obj, HMON_THROWN, dieroll)
|
||||
&& !is_whirly(mtmp->data))
|
||||
return FALSE; /* still alive */
|
||||
}
|
||||
mtmp->mtrapped = 0;
|
||||
|
||||
+13
-10
@@ -884,7 +884,7 @@ boolean hitsroof;
|
||||
/* object now hits you */
|
||||
|
||||
if (obj->oclass == POTION_CLASS) {
|
||||
potionhit(&youmonst, obj, TRUE);
|
||||
potionhit(&youmonst, obj, POTHIT_HERO_THROW);
|
||||
} else if (breaktest(obj)) {
|
||||
int otyp = obj->otyp;
|
||||
int blindinc;
|
||||
@@ -1086,7 +1086,7 @@ boolean
|
||||
&& rn2(6)) {
|
||||
/* alternative to prayer or wand of opening/spell of knock
|
||||
for dealing with cursed saddle: throw holy water > */
|
||||
potionhit(u.usteed, obj, TRUE);
|
||||
potionhit(u.usteed, obj, POTHIT_HERO_THROW);
|
||||
} else {
|
||||
hitfloor(obj);
|
||||
}
|
||||
@@ -1386,6 +1386,7 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
|
||||
register int disttmp; /* distance modifier */
|
||||
int otyp = obj->otyp, hmode;
|
||||
boolean guaranteed_hit = (u.uswallow && mon == u.ustuck);
|
||||
int dieroll;
|
||||
|
||||
hmode = (obj == uwep) ? HMON_APPLIED
|
||||
: (obj == kickedobj) ? HMON_KICKED
|
||||
@@ -1493,6 +1494,8 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
|
||||
return 0;
|
||||
}
|
||||
|
||||
dieroll = rnd(20);
|
||||
|
||||
if (obj->oclass == WEAPON_CLASS || is_weptool(obj)
|
||||
|| obj->oclass == GEM_CLASS) {
|
||||
if (hmode == HMON_KICKED) {
|
||||
@@ -1533,13 +1536,13 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
|
||||
tmp += weapon_hit_bonus(obj);
|
||||
}
|
||||
|
||||
if (tmp >= rnd(20)) {
|
||||
if (tmp >= dieroll) {
|
||||
boolean wasthrown = (thrownobj != 0);
|
||||
|
||||
/* attack hits mon */
|
||||
if (hmode == HMON_APPLIED)
|
||||
u.uconduct.weaphit++;
|
||||
if (hmon(mon, obj, hmode)) { /* mon still alive */
|
||||
if (hmon(mon, obj, hmode, dieroll)) { /* mon still alive */
|
||||
cutworm(mon, bhitpos.x, bhitpos.y, obj);
|
||||
}
|
||||
exercise(A_DEX, TRUE);
|
||||
@@ -1585,11 +1588,11 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
|
||||
|
||||
} else if (otyp == HEAVY_IRON_BALL) {
|
||||
exercise(A_STR, TRUE);
|
||||
if (tmp >= rnd(20)) {
|
||||
if (tmp >= dieroll) {
|
||||
int was_swallowed = guaranteed_hit;
|
||||
|
||||
exercise(A_DEX, TRUE);
|
||||
if (!hmon(mon, obj, hmode)) { /* mon killed */
|
||||
if (!hmon(mon, obj, hmode, dieroll)) { /* mon killed */
|
||||
if (was_swallowed && !u.uswallow && obj == uball)
|
||||
return 1; /* already did placebc() */
|
||||
}
|
||||
@@ -1599,9 +1602,9 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
|
||||
|
||||
} else if (otyp == BOULDER) {
|
||||
exercise(A_STR, TRUE);
|
||||
if (tmp >= rnd(20)) {
|
||||
if (tmp >= dieroll) {
|
||||
exercise(A_DEX, TRUE);
|
||||
(void) hmon(mon, obj, hmode);
|
||||
(void) hmon(mon, obj, hmode, dieroll);
|
||||
} else {
|
||||
tmiss(obj, mon, TRUE);
|
||||
}
|
||||
@@ -1609,12 +1612,12 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
|
||||
} else if ((otyp == EGG || otyp == CREAM_PIE || otyp == BLINDING_VENOM
|
||||
|| otyp == ACID_VENOM)
|
||||
&& (guaranteed_hit || ACURR(A_DEX) > rnd(25))) {
|
||||
(void) hmon(mon, obj, hmode);
|
||||
(void) hmon(mon, obj, hmode, dieroll);
|
||||
return 1; /* hmon used it up */
|
||||
|
||||
} else if (obj->oclass == POTION_CLASS
|
||||
&& (guaranteed_hit || ACURR(A_DEX) > rnd(25))) {
|
||||
potionhit(mon, obj, TRUE);
|
||||
potionhit(mon, obj, POTHIT_HERO_THROW);
|
||||
return 1;
|
||||
|
||||
} else if (befriend_with_obj(mon->data, obj)
|
||||
|
||||
@@ -1277,7 +1277,7 @@ int how;
|
||||
destroy_nhwindow(WIN_INVEN), WIN_INVEN = WIN_ERR;
|
||||
display_nhwindow(WIN_MESSAGE, TRUE);
|
||||
destroy_nhwindow(WIN_MAP), WIN_MAP = WIN_ERR;
|
||||
#ifndef STATUS_VIA_WINDOWPORT
|
||||
#ifndef STATUS_HILITES
|
||||
destroy_nhwindow(WIN_STATUS), WIN_STATUS = WIN_ERR;
|
||||
#endif
|
||||
destroy_nhwindow(WIN_MESSAGE), WIN_MESSAGE = WIN_ERR;
|
||||
|
||||
+8
-7
@@ -570,7 +570,7 @@ struct obj *obj; /* only scatter this obj */
|
||||
struct scatter_chain *schain = (struct scatter_chain *) 0;
|
||||
long total = 0L;
|
||||
|
||||
while ((otmp = individual_object ? obj : level.objects[sx][sy]) != 0) {
|
||||
while ((otmp = (individual_object ? obj : level.objects[sx][sy])) != 0) {
|
||||
if (otmp->quan > 1L) {
|
||||
qtmp = otmp->quan - 1L;
|
||||
if (qtmp > LARGEST_INT)
|
||||
@@ -584,8 +584,8 @@ struct obj *obj; /* only scatter this obj */
|
||||
used_up = FALSE;
|
||||
|
||||
/* 9 in 10 chance of fracturing boulders or statues */
|
||||
if ((scflags & MAY_FRACTURE)
|
||||
&& ((otmp->otyp == BOULDER) || (otmp->otyp == STATUE))
|
||||
if ((scflags & MAY_FRACTURE) != 0
|
||||
&& (otmp->otyp == BOULDER || otmp->otyp == STATUE)
|
||||
&& rn2(10)) {
|
||||
if (otmp->otyp == BOULDER) {
|
||||
if (cansee(sx, sy))
|
||||
@@ -614,7 +614,7 @@ struct obj *obj; /* only scatter this obj */
|
||||
used_up = TRUE;
|
||||
|
||||
/* 1 in 10 chance of destruction of obj; glass, egg destruction */
|
||||
} else if ((scflags & MAY_DESTROY)
|
||||
} else if ((scflags & MAY_DESTROY) != 0
|
||||
&& (!rn2(10) || (objects[otmp->otyp].oc_material == GLASS
|
||||
|| otmp->otyp == EGG))) {
|
||||
if (breaks(otmp, (xchar) sx, (xchar) sy))
|
||||
@@ -622,8 +622,7 @@ struct obj *obj; /* only scatter this obj */
|
||||
}
|
||||
|
||||
if (!used_up) {
|
||||
stmp = (struct scatter_chain *)
|
||||
alloc(sizeof (struct scatter_chain));
|
||||
stmp = (struct scatter_chain *) alloc(sizeof *stmp);
|
||||
stmp->next = (struct scatter_chain *) 0;
|
||||
stmp->obj = otmp;
|
||||
stmp->ox = sx;
|
||||
@@ -679,7 +678,9 @@ struct obj *obj; /* only scatter this obj */
|
||||
if (bigmonst(youmonst.data))
|
||||
hitvalu++;
|
||||
hitu = thitu(hitvalu, dmgval(stmp->obj, &youmonst),
|
||||
stmp->obj, (char *) 0);
|
||||
&stmp->obj, (char *) 0);
|
||||
if (!stmp->obj)
|
||||
stmp->stopped = TRUE;
|
||||
if (hitu) {
|
||||
stmp->range -= 3;
|
||||
stop_occupation();
|
||||
|
||||
@@ -2540,6 +2540,11 @@ char *origbuf;
|
||||
} else if (match_varname(buf, "MENUCOLOR", 9)) {
|
||||
if (!add_menu_coloring(bufp))
|
||||
retval = FALSE;
|
||||
} else if (match_varname(buf, "HILITE_STATUS", 6)) {
|
||||
#ifdef STATUS_HILITES
|
||||
if (!parse_status_hl1(bufp, TRUE))
|
||||
retval = FALSE;
|
||||
#endif
|
||||
} else if (match_varname(buf, "WARNINGS", 5)) {
|
||||
(void) get_uchars(bufp, translate, FALSE, WARNCOUNT,
|
||||
"WARNINGS");
|
||||
|
||||
+4
-1
@@ -1161,7 +1161,7 @@ trapmove(x, y, desttrap)
|
||||
int x, y; /* targetted destination, <u.ux+u.dx,u.uy+u.dy> */
|
||||
struct trap *desttrap; /* nonnull if another trap at <x,y> */
|
||||
{
|
||||
boolean anchored;
|
||||
boolean anchored = FALSE;
|
||||
const char *predicament, *culprit;
|
||||
char *steedname = !u.usteed ? (char *) 0 : y_monnam(u.usteed);
|
||||
|
||||
@@ -1180,6 +1180,8 @@ struct trap *desttrap; /* nonnull if another trap at <x,y> */
|
||||
/* [why does diagonal movement give quickest escape?] */
|
||||
if ((u.dx && u.dy) || !rn2(5))
|
||||
u.utrap--;
|
||||
if (!u.utrap)
|
||||
goto wriggle_free;
|
||||
break;
|
||||
case TT_PIT:
|
||||
if (desttrap && desttrap->tseen
|
||||
@@ -1271,6 +1273,7 @@ struct trap *desttrap; /* nonnull if another trap at <x,y> */
|
||||
Norep("You are %s %s.", predicament, culprit);
|
||||
}
|
||||
} else {
|
||||
wriggle_free:
|
||||
if (u.usteed)
|
||||
pline("%s finally %s free.", upstart(steedname),
|
||||
!anchored ? "lurches" : "wrenches the ball");
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
char * mungspaces (char *)
|
||||
char * trimspaces (char *)
|
||||
char * strip_newline (char *)
|
||||
char * stripchars (char *, const char *, const char *)
|
||||
char * eos (char *)
|
||||
boolean str_end_is (const char *, const char *)
|
||||
char * strkitten (char *,char)
|
||||
@@ -433,6 +434,31 @@ char c;
|
||||
return ccc;
|
||||
}
|
||||
|
||||
/* strip all the chars in stuff_to_strip from orig */
|
||||
/* caller is responsible for ensuring that bp is a
|
||||
valid pointer to a BUFSZ buffer */
|
||||
char *
|
||||
stripchars(bp, stuff_to_strip, orig)
|
||||
char *bp;
|
||||
const char *stuff_to_strip, *orig;
|
||||
{
|
||||
int i = 0;
|
||||
char *s = bp;
|
||||
|
||||
if (s) {
|
||||
while (s && *orig && i < (BUFSZ - 1)) {
|
||||
if (!index(stuff_to_strip, *orig)) {
|
||||
*s++ = *orig;
|
||||
i++;
|
||||
}
|
||||
orig++;
|
||||
}
|
||||
*s = '\0';
|
||||
} else
|
||||
impossible("no output buf in stripchars");
|
||||
return bp;
|
||||
}
|
||||
|
||||
/* substitute a word or phrase in a string (in place) */
|
||||
/* caller is responsible for ensuring that bp points to big enough buffer */
|
||||
char *
|
||||
|
||||
+3
-1
@@ -1339,7 +1339,7 @@ int
|
||||
weight(obj)
|
||||
register struct obj *obj;
|
||||
{
|
||||
int wt = objects[obj->otyp].oc_weight;
|
||||
int wt = (int) objects[obj->otyp].oc_weight;
|
||||
|
||||
/* glob absorpsion means that merging globs accumulates weight while
|
||||
quantity stays 1, so update 'wt' to reflect that, unless owt is 0,
|
||||
@@ -1390,6 +1390,8 @@ register struct obj *obj;
|
||||
return (int) ((obj->quan + 50L) / 100L);
|
||||
} else if (obj->otyp == HEAVY_IRON_BALL && obj->owt != 0) {
|
||||
return (int) obj->owt; /* kludge for "very" heavy iron ball */
|
||||
} else if (obj->otyp == CANDELABRUM_OF_INVOCATION && obj->spe) {
|
||||
return wt + obj->spe * (int) objects[TALLOW_CANDLE].oc_weight;
|
||||
}
|
||||
return (wt ? wt * (int) obj->quan : ((int) obj->quan + 1) >> 1);
|
||||
}
|
||||
|
||||
+27
-18
@@ -29,11 +29,12 @@ extern boolean notonhead; /* for long worms */
|
||||
|
||||
/* hero is hit by something other than a monster */
|
||||
int
|
||||
thitu(tlev, dam, obj, name)
|
||||
thitu(tlev, dam, objp, name)
|
||||
int tlev, dam;
|
||||
struct obj *obj;
|
||||
const char *name; /* if null, then format `obj' */
|
||||
struct obj **objp;
|
||||
const char *name; /* if null, then format `*objp' */
|
||||
{
|
||||
struct obj *obj = objp ? *objp : 0;
|
||||
const char *onm, *knm;
|
||||
boolean is_acid;
|
||||
int kprefix = KILLED_BY_AN;
|
||||
@@ -42,8 +43,8 @@ const char *name; /* if null, then format `obj' */
|
||||
if (!name) {
|
||||
if (!obj)
|
||||
panic("thitu: name & obj both null?");
|
||||
name =
|
||||
strcpy(onmbuf, (obj->quan > 1L) ? doname(obj) : mshot_xname(obj));
|
||||
name = strcpy(onmbuf,
|
||||
(obj->quan > 1L) ? doname(obj) : mshot_xname(obj));
|
||||
knm = strcpy(knmbuf, killer_xname(obj));
|
||||
kprefix = KILLED_BY; /* killer_name supplies "an" if warranted */
|
||||
} else {
|
||||
@@ -70,14 +71,20 @@ const char *name; /* if null, then format `obj' */
|
||||
else
|
||||
You("are hit by %s%s", onm, exclam(dam));
|
||||
|
||||
if (obj && objects[obj->otyp].oc_material == SILVER && Hate_silver) {
|
||||
/* extra damage already applied by dmgval() */
|
||||
pline_The("silver sears your flesh!");
|
||||
exercise(A_CON, FALSE);
|
||||
}
|
||||
if (is_acid && Acid_resistance) {
|
||||
pline("It doesn't seem to hurt you.");
|
||||
} else if (obj && obj->oclass == POTION_CLASS) {
|
||||
/* an explosion which scatters objects might hit hero with one
|
||||
(potions deliberately thrown at hero are handled by m_throw) */
|
||||
potionhit(&youmonst, obj, POTHIT_OTHER_THROW);
|
||||
*objp = obj = 0; /* potionhit() uses up the potion */
|
||||
} else {
|
||||
if (obj && objects[obj->otyp].oc_material == SILVER
|
||||
&& Hate_silver) {
|
||||
/* extra damage already applied by dmgval() */
|
||||
pline_The("silver sears your flesh!");
|
||||
exercise(A_CON, FALSE);
|
||||
}
|
||||
if (is_acid)
|
||||
pline("It burns!");
|
||||
losehp(dam, knm, kprefix); /* acid damage */
|
||||
@@ -110,9 +117,9 @@ int x, y;
|
||||
else
|
||||
create = 1;
|
||||
|
||||
if (create
|
||||
&& !((mtmp = m_at(x, y)) && (mtmp->mtrapped) && (t = t_at(x, y))
|
||||
&& ((t->ttyp == PIT) || (t->ttyp == SPIKED_PIT)))) {
|
||||
if (create && !((mtmp = m_at(x, y)) != 0 && mtmp->mtrapped
|
||||
&& (t = t_at(x, y)) != 0
|
||||
&& (t->ttyp == PIT || t->ttyp == SPIKED_PIT))) {
|
||||
int objgone = 0;
|
||||
|
||||
if (down_gate(x, y) != -1)
|
||||
@@ -329,7 +336,9 @@ boolean verbose; /* give message(s) even when you can't see what happened */
|
||||
mtmp->msleeping = 0;
|
||||
if (vis)
|
||||
otmp->dknown = 1;
|
||||
potionhit(mtmp, otmp, FALSE);
|
||||
/* probably thrown by a monster rather than 'other', but the
|
||||
distinction only matters when hitting the hero */
|
||||
potionhit(mtmp, otmp, POTHIT_OTHER_THROW);
|
||||
return 1;
|
||||
} else {
|
||||
damage = dmgval(otmp, mtmp);
|
||||
@@ -549,7 +558,7 @@ struct obj *obj; /* missile (or stack providing it) */
|
||||
if (singleobj->oclass == POTION_CLASS) {
|
||||
if (!Blind)
|
||||
singleobj->dknown = 1;
|
||||
potionhit(&youmonst, singleobj, FALSE);
|
||||
potionhit(&youmonst, singleobj, POTHIT_MONST_THROW);
|
||||
break;
|
||||
}
|
||||
oldumort = u.umortality;
|
||||
@@ -565,7 +574,7 @@ struct obj *obj; /* missile (or stack providing it) */
|
||||
/* fall through */
|
||||
case CREAM_PIE:
|
||||
case BLINDING_VENOM:
|
||||
hitu = thitu(8, 0, singleobj, (char *) 0);
|
||||
hitu = thitu(8, 0, &singleobj, (char *) 0);
|
||||
break;
|
||||
default:
|
||||
dam = dmgval(singleobj, &youmonst);
|
||||
@@ -585,7 +594,7 @@ struct obj *obj; /* missile (or stack providing it) */
|
||||
hitv += 8 + singleobj->spe;
|
||||
if (dam < 1)
|
||||
dam = 1;
|
||||
hitu = thitu(hitv, dam, singleobj, (char *) 0);
|
||||
hitu = thitu(hitv, dam, &singleobj, (char *) 0);
|
||||
}
|
||||
if (hitu && singleobj->opoisoned && is_poisonable(singleobj)) {
|
||||
char onmbuf[BUFSZ], knmbuf[BUFSZ];
|
||||
@@ -888,7 +897,7 @@ struct monst *mtmp;
|
||||
if (dam < 1)
|
||||
dam = 1;
|
||||
|
||||
(void) thitu(hitv, dam, otmp, (char *) 0);
|
||||
(void) thitu(hitv, dam, &otmp, (char *) 0);
|
||||
stop_occupation();
|
||||
return;
|
||||
}
|
||||
|
||||
+4
-1
@@ -1106,8 +1106,11 @@ unsigned doname_flags;
|
||||
"corpse" is already in the buffer returned by xname() */
|
||||
unsigned cxarg = (((obj->quan != 1L) ? 0 : CXN_ARTICLE)
|
||||
| CXN_NOCORPSE);
|
||||
char *cxstr = corpse_xname(obj, prefix, cxarg);
|
||||
|
||||
Sprintf(prefix, "%s ", corpse_xname(obj, prefix, cxarg));
|
||||
Sprintf(prefix, "%s ", cxstr);
|
||||
/* avoid having doname(corpse) consume an extra obuf */
|
||||
releaseobuf(cxstr);
|
||||
} else if (obj->otyp == EGG) {
|
||||
#if 0 /* corpses don't tell if they're stale either */
|
||||
if (known && stale_egg(obj))
|
||||
|
||||
+80
-52
@@ -131,6 +131,9 @@ static struct Bool_Opt {
|
||||
{ "help", &flags.help, TRUE, SET_IN_GAME },
|
||||
{ "hilite_pet", &iflags.wc_hilite_pet, FALSE, SET_IN_GAME }, /*WC*/
|
||||
{ "hilite_pile", &iflags.hilite_pile, FALSE, SET_IN_GAME },
|
||||
#ifdef STATUS_HILITES
|
||||
{ "hitpointbar", &iflags.wc2_hitpointbar, FALSE, SET_IN_GAME }, /*WC2*/
|
||||
#endif
|
||||
#ifndef MAC
|
||||
{ "ignintr", &flags.ignintr, FALSE, SET_IN_GAME },
|
||||
#else
|
||||
@@ -205,11 +208,6 @@ static struct Bool_Opt {
|
||||
{ "sparkle", &flags.sparkle, TRUE, SET_IN_GAME },
|
||||
{ "splash_screen", &iflags.wc_splash_screen, TRUE, DISP_IN_GAME }, /*WC*/
|
||||
{ "standout", &flags.standout, FALSE, SET_IN_GAME },
|
||||
#if defined(STATUS_VIA_WINDOWPORT) && defined(STATUS_HILITES)
|
||||
{ "statushilites", &iflags.use_status_hilites, TRUE, SET_IN_GAME },
|
||||
#else
|
||||
{ "statushilites", &iflags.use_status_hilites, FALSE, DISP_IN_GAME },
|
||||
#endif
|
||||
{ "status_updates", &iflags.status_updates, TRUE, DISP_IN_GAME },
|
||||
{ "tiled_map", &iflags.wc_tiled_map, PREFER_TILED, DISP_IN_GAME }, /*WC*/
|
||||
{ "time", &flags.time, FALSE, SET_IN_GAME },
|
||||
@@ -375,6 +373,13 @@ static struct Comp_Opt {
|
||||
SET_IN_GAME },
|
||||
#ifdef MSDOS
|
||||
{ "soundcard", "type of sound card to use", 20, SET_IN_FILE },
|
||||
#endif
|
||||
#ifdef STATUS_HILITES
|
||||
{ "statushilites",
|
||||
"0=no status highlighting, N=show highlights for N turns",
|
||||
20, SET_IN_GAME },
|
||||
#else
|
||||
{ "statushilites", "highlight control", 20, SET_IN_FILE },
|
||||
#endif
|
||||
{ "symset", "load a set of display symbols from the symbols file", 70,
|
||||
SET_IN_GAME },
|
||||
@@ -516,10 +521,7 @@ STATIC_DCL int FDECL(feature_alert_opts, (char *, const char *));
|
||||
STATIC_DCL boolean FDECL(duplicate_opt_detection, (const char *, int));
|
||||
STATIC_DCL void FDECL(complain_about_duplicate, (const char *, int));
|
||||
|
||||
STATIC_DCL int FDECL(match_str2attr, (const char *));
|
||||
STATIC_DCL const char *FDECL(attr2attrname, (int));
|
||||
STATIC_DCL int NDECL(query_color);
|
||||
STATIC_DCL int FDECL(query_attr, (const char *));
|
||||
STATIC_DCL const char * FDECL(msgtype2name, (int));
|
||||
STATIC_DCL int NDECL(query_msgtype);
|
||||
STATIC_DCL boolean FDECL(msgtype_add, (int, char *));
|
||||
@@ -1279,9 +1281,9 @@ static const struct {
|
||||
{ "light magenta", CLR_BRIGHT_MAGENTA },
|
||||
{ "light cyan", CLR_BRIGHT_CYAN },
|
||||
{ "white", CLR_WHITE },
|
||||
{ "no color", NO_COLOR },
|
||||
{ NULL, CLR_BLACK }, /* everything after this is an alias */
|
||||
{ "transparent", NO_COLOR },
|
||||
{ "nocolor", NO_COLOR },
|
||||
{ "purple", CLR_MAGENTA },
|
||||
{ "light purple", CLR_BRIGHT_MAGENTA },
|
||||
{ "bright purple", CLR_BRIGHT_MAGENTA },
|
||||
@@ -1302,7 +1304,10 @@ static const struct {
|
||||
{ "dim", ATR_DIM },
|
||||
{ "underline", ATR_ULINE },
|
||||
{ "blink", ATR_BLINK },
|
||||
{ "inverse", ATR_INVERSE }
|
||||
{ "inverse", ATR_INVERSE },
|
||||
{ NULL, ATR_NONE }, /* everything after this is an alias */
|
||||
{ "normal", ATR_NONE },
|
||||
{ "uline", ATR_ULINE }
|
||||
};
|
||||
|
||||
const char *
|
||||
@@ -1321,7 +1326,7 @@ int
|
||||
match_str2clr(str)
|
||||
char *str;
|
||||
{
|
||||
int i, c = NO_COLOR;
|
||||
int i, c = CLR_MAX;
|
||||
|
||||
/* allow "lightblue", "light blue", and "light-blue" to match "light blue"
|
||||
(also junk like "_l i-gh_t---b l u e" but we won't worry about that);
|
||||
@@ -1353,9 +1358,10 @@ int attr;
|
||||
return (char *) 0;
|
||||
}
|
||||
|
||||
STATIC_OVL int
|
||||
match_str2attr(str)
|
||||
int
|
||||
match_str2attr(str, complain)
|
||||
const char *str;
|
||||
boolean complain;
|
||||
{
|
||||
int i, a = -1;
|
||||
|
||||
@@ -1366,14 +1372,15 @@ const char *str;
|
||||
break;
|
||||
}
|
||||
|
||||
if (a == -1)
|
||||
if (a == -1 && complain)
|
||||
config_error_add("Unknown text attribute '%s'", str);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
STATIC_OVL int
|
||||
query_color()
|
||||
int
|
||||
query_color(prompt)
|
||||
const char *prompt;
|
||||
{
|
||||
winid tmpwin;
|
||||
anything any;
|
||||
@@ -1390,7 +1397,7 @@ query_color()
|
||||
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, colornames[i].name,
|
||||
MENU_UNSELECTED);
|
||||
}
|
||||
end_menu(tmpwin, "Pick a color");
|
||||
end_menu(tmpwin, (prompt && *prompt) ? prompt : "Pick a color");
|
||||
pick_cnt = select_menu(tmpwin, PICK_ONE, &picks);
|
||||
destroy_nhwindow(tmpwin);
|
||||
if (pick_cnt > 0) {
|
||||
@@ -1401,7 +1408,7 @@ query_color()
|
||||
return -1;
|
||||
}
|
||||
|
||||
STATIC_OVL int
|
||||
int
|
||||
query_attr(prompt)
|
||||
const char *prompt;
|
||||
{
|
||||
@@ -1420,7 +1427,7 @@ const char *prompt;
|
||||
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, attrnames[i].attr,
|
||||
attrnames[i].name, MENU_UNSELECTED);
|
||||
}
|
||||
end_menu(tmpwin, prompt ? prompt : "Pick an attribute");
|
||||
end_menu(tmpwin, (prompt && *prompt) ? prompt : "Pick an attribute");
|
||||
pick_cnt = select_menu(tmpwin, PICK_ONE, &picks);
|
||||
destroy_nhwindow(tmpwin);
|
||||
if (pick_cnt > 0) {
|
||||
@@ -1706,7 +1713,7 @@ char *tmpstr;
|
||||
|
||||
if (amp) {
|
||||
tmps = amp + 1; /* advance past '&' */
|
||||
a = match_str2attr(tmps);
|
||||
a = match_str2attr(tmps, TRUE);
|
||||
if (a == -1)
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3427,7 +3434,7 @@ boolean tinitial, tfrom_file;
|
||||
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
|
||||
return FALSE;
|
||||
}
|
||||
tmpattr = match_str2attr(opts);
|
||||
tmpattr = match_str2attr(opts, TRUE);
|
||||
if (tmpattr == -1)
|
||||
return FALSE;
|
||||
else
|
||||
@@ -3458,23 +3465,39 @@ boolean tinitial, tfrom_file;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
#if defined(STATUS_VIA_WINDOWPORT) && defined(STATUS_HILITES)
|
||||
#ifdef STATUS_HILITES
|
||||
/* hilite fields in status prompt */
|
||||
if (match_optname(opts, "hilite_status", 13, TRUE)) {
|
||||
if (duplicate)
|
||||
complain_about_duplicate(opts, 1);
|
||||
op = string_for_opt(opts, TRUE);
|
||||
if (op && negated) {
|
||||
clear_status_hilites(tfrom_file);
|
||||
clear_status_hilites();
|
||||
return retval;
|
||||
} else if (!op) {
|
||||
config_error_add("Value is mandatory for hilite_status");
|
||||
return FALSE;
|
||||
}
|
||||
if (!set_status_hilites(op, tfrom_file)) /* TODO: error msg? */
|
||||
if (!parse_status_hl1(op, tfrom_file))
|
||||
return FALSE;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* control over whether highlights should be displayed, and for how long */
|
||||
fullname = "statushilites";
|
||||
if (match_optname(opts, fullname, 9, TRUE)) {
|
||||
if (negated) {
|
||||
iflags.hilite_delta = 0L;
|
||||
} else {
|
||||
op = string_for_opt(opts, TRUE);
|
||||
iflags.hilite_delta = (!op || !*op) ? 3L : atol(op);
|
||||
if (iflags.hilite_delta < 0L)
|
||||
iflags.hilite_delta = 1L;
|
||||
}
|
||||
if (!tfrom_file)
|
||||
reset_status_hilites();
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(BACKWARD_COMPAT)
|
||||
@@ -3624,7 +3647,7 @@ boolean tinitial, tfrom_file;
|
||||
|| boolopt[i].addr == &flags.showscore
|
||||
#endif
|
||||
|| boolopt[i].addr == &flags.showexp) {
|
||||
#ifdef STATUS_VIA_WINDOWPORT
|
||||
#ifdef STATUS_HILITES
|
||||
status_initialize(REASSESS_ONLY);
|
||||
#endif
|
||||
context.botl = TRUE;
|
||||
@@ -3650,6 +3673,9 @@ boolean tinitial, tfrom_file;
|
||||
|| boolopt[i].addr == &iflags.hilite_pile
|
||||
|| boolopt[i].addr == &iflags.hilite_pet) {
|
||||
need_redraw = TRUE;
|
||||
} else if ((boolopt[i].addr) == &iflags.wc2_hitpointbar) {
|
||||
status_initialize(REASSESS_ONLY);
|
||||
need_redraw = TRUE;
|
||||
#ifdef TEXTCOLOR
|
||||
} else if (boolopt[i].addr == &iflags.use_color) {
|
||||
need_redraw = TRUE;
|
||||
@@ -3937,6 +3963,12 @@ int nset;
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED);
|
||||
}
|
||||
|
||||
int
|
||||
count_apes()
|
||||
{
|
||||
return count_ape_maps((int *) 0, (int *) 0);
|
||||
}
|
||||
|
||||
enum opt_other_enums {
|
||||
OPT_OTHER_MSGTYPE = -4,
|
||||
OPT_OTHER_MENUCOLOR = -3,
|
||||
@@ -3945,19 +3977,18 @@ enum opt_other_enums {
|
||||
/* these must be < 0 */
|
||||
};
|
||||
|
||||
/* presently only used when determining longest option name */
|
||||
static struct other_opts {
|
||||
const char *name;
|
||||
int optflags;
|
||||
enum opt_other_enums code;
|
||||
int NDECL((*othr_count_func));
|
||||
} othropt[] = {
|
||||
{ "autopickup exceptions", SET_IN_GAME, OPT_OTHER_APEXC },
|
||||
{ "menucolors", SET_IN_GAME, OPT_OTHER_MENUCOLOR },
|
||||
{ "message types", SET_IN_GAME, OPT_OTHER_MSGTYPE },
|
||||
#ifdef STATUS_VIA_WINDOWPORT
|
||||
{ "autopickup exceptions", SET_IN_GAME, OPT_OTHER_APEXC, count_apes },
|
||||
{ "menucolors", SET_IN_GAME, OPT_OTHER_MENUCOLOR, count_menucolors },
|
||||
{ "message types", SET_IN_GAME, OPT_OTHER_MSGTYPE, msgtype_count },
|
||||
#ifdef STATUS_HILITES
|
||||
{ "status_hilites", SET_IN_GAME, OPT_OTHER_STATHILITE },
|
||||
#endif
|
||||
{ "status hilite rules", SET_IN_GAME, OPT_OTHER_STATHILITE,
|
||||
count_status_hilites },
|
||||
#endif
|
||||
{ (char *) 0, 0, (enum opt_other_enums) 0 },
|
||||
};
|
||||
@@ -4086,20 +4117,10 @@ doset() /* changing options via menu by Per Liboriussen */
|
||||
"Other settings:",
|
||||
MENU_UNSELECTED);
|
||||
|
||||
opts_add_others(tmpwin, "autopickup exceptions", OPT_OTHER_APEXC,
|
||||
NULL, count_ape_maps((int *) 0, (int *) 0));
|
||||
opts_add_others(tmpwin, "menucolors", OPT_OTHER_MENUCOLOR,
|
||||
NULL, count_menucolors());
|
||||
opts_add_others(tmpwin, "message types", OPT_OTHER_MSGTYPE,
|
||||
NULL, msgtype_count());
|
||||
#ifdef STATUS_VIA_WINDOWPORT
|
||||
#ifdef STATUS_HILITES
|
||||
get_status_hilites(buf2, 60);
|
||||
if (!*buf2)
|
||||
Sprintf(buf2, "%s", "(none)");
|
||||
opts_add_others(tmpwin, "status_hilites", OPT_OTHER_STATHILITE, buf2, 0);
|
||||
#endif
|
||||
#endif
|
||||
for (i = 0; othropt[i].name; i++)
|
||||
opts_add_others(tmpwin, othropt[i].name, othropt[i].code,
|
||||
NULL, othropt[i].othr_count_func());
|
||||
|
||||
#ifdef PREFIXES_IN_USE
|
||||
any = zeroany;
|
||||
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
|
||||
@@ -4123,16 +4144,14 @@ doset() /* changing options via menu by Per Liboriussen */
|
||||
if (opt_indx == OPT_OTHER_APEXC) {
|
||||
(void) special_handling("autopickup_exception", setinitial,
|
||||
fromfile);
|
||||
#ifdef STATUS_VIA_WINDOWPORT
|
||||
#ifdef STATUS_HILITES
|
||||
} else if (opt_indx == OPT_OTHER_STATHILITE) {
|
||||
if (!status_hilite_menu()) {
|
||||
pline("Bad status hilite(s) specified.");
|
||||
} else {
|
||||
if (wc2_supported("status_hilites"))
|
||||
preference_update("status_hilites");
|
||||
if (wc2_supported("hilite_status"))
|
||||
preference_update("hilite_status");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
} else if (opt_indx == OPT_OTHER_MENUCOLOR) {
|
||||
(void) special_handling("menucolors", setinitial,
|
||||
@@ -4728,7 +4747,7 @@ boolean setinitial, setfromfile;
|
||||
return TRUE;
|
||||
if (*mcbuf
|
||||
&& test_regex_pattern(mcbuf, (const char *)0)
|
||||
&& (mcclr = query_color()) != -1
|
||||
&& (mcclr = query_color((char *) 0)) != -1
|
||||
&& (mcattr = query_attr((char *) 0)) != -1
|
||||
&& !add_menu_coloring_parsed(mcbuf, mcclr, mcattr)) {
|
||||
pline("Error adding the menu color.");
|
||||
@@ -5305,6 +5324,14 @@ char *buf;
|
||||
#ifdef MSDOS
|
||||
} else if (!strcmp(optname, "soundcard")) {
|
||||
Sprintf(buf, "%s", to_be_done);
|
||||
#endif
|
||||
#ifdef STATUS_HILITES
|
||||
} else if (!strcmp("statushilites", optname)) {
|
||||
if (!iflags.hilite_delta)
|
||||
Strcpy(buf, "0 (off: don't highlight status fields)");
|
||||
else
|
||||
Sprintf(buf, "%ld (on: highlight status for %ld turns)",
|
||||
iflags.hilite_delta, iflags.hilite_delta);
|
||||
#endif
|
||||
} else if (!strcmp(optname, "suppress_alert")) {
|
||||
if (flags.suppress_alert == 0L)
|
||||
@@ -6010,7 +6037,8 @@ struct wc_Opt wc2_options[] = { { "fullscreen", WC2_FULLSCREEN },
|
||||
{ "softkeyboard", WC2_SOFTKEYBOARD },
|
||||
{ "wraptext", WC2_WRAPTEXT },
|
||||
{ "use_darkgray", WC2_DARKGRAY },
|
||||
#ifdef STATUS_VIA_WINDOWPORT
|
||||
#ifdef STATUS_HILITES
|
||||
{ "hitpointbar", WC2_HITPOINTBAR },
|
||||
{ "hilite_status", WC2_HILITE_STATUS },
|
||||
#endif
|
||||
{ (char *) 0, 0L } };
|
||||
|
||||
+3
-1
@@ -107,9 +107,11 @@ set_uasmon()
|
||||
youmonst.movement = new_speed * youmonst.movement / old_speed;
|
||||
}
|
||||
|
||||
#ifdef STATUS_VIA_WINDOWPORT
|
||||
#ifdef STATUS_HILITES
|
||||
status_initialize(REASSESS_ONLY);
|
||||
#endif
|
||||
|
||||
polysense();
|
||||
}
|
||||
|
||||
/* Levitation overrides Flying; set or clear BFlying|I_SPECIAL */
|
||||
|
||||
+11
-6
@@ -1243,24 +1243,28 @@ const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */
|
||||
return res;
|
||||
}
|
||||
|
||||
/* potion obj hits monster mon, which might be youmonst; obj always use up */
|
||||
void
|
||||
potionhit(mon, obj, your_fault)
|
||||
register struct monst *mon;
|
||||
register struct obj *obj;
|
||||
boolean your_fault;
|
||||
potionhit(mon, obj, how)
|
||||
struct monst *mon;
|
||||
struct obj *obj;
|
||||
int how;
|
||||
{
|
||||
const char *botlnam = bottlename();
|
||||
boolean isyou = (mon == &youmonst);
|
||||
int distance, tx, ty;
|
||||
struct obj *saddle = (struct obj *) 0;
|
||||
boolean hit_saddle = FALSE;
|
||||
boolean hit_saddle = FALSE, your_fault = (how <= POTHIT_HERO_THROW);
|
||||
|
||||
if (isyou) {
|
||||
tx = u.ux, ty = u.uy;
|
||||
distance = 0;
|
||||
pline_The("%s crashes on your %s and breaks into shards.", botlnam,
|
||||
body_part(HEAD));
|
||||
losehp(Maybe_Half_Phys(rnd(2)), "thrown potion", KILLED_BY_AN);
|
||||
losehp(Maybe_Half_Phys(rnd(2)),
|
||||
(how == POTHIT_OTHER_THROW) ? "propelled potion" /* scatter */
|
||||
: "thrown potion",
|
||||
KILLED_BY_AN);
|
||||
} else {
|
||||
tx = mon->mx, ty = mon->my;
|
||||
/* sometimes it hits the saddle */
|
||||
@@ -1314,6 +1318,7 @@ boolean your_fault;
|
||||
case POT_ACID:
|
||||
if (!Acid_resistance) {
|
||||
int dmg;
|
||||
|
||||
pline("This burns%s!",
|
||||
obj->blessed ? " a little"
|
||||
: obj->cursed ? " a lot" : "");
|
||||
|
||||
+1
-1
@@ -1413,7 +1413,7 @@ freedynamicdata()
|
||||
/* free_pickinv_cache(); -- now done from really_done()... */
|
||||
free_symsets();
|
||||
#endif /* FREE_ALL_MEMORY */
|
||||
#ifdef STATUS_VIA_WINDOWPORT
|
||||
#ifdef STATUS_HILITES
|
||||
status_finish();
|
||||
#endif
|
||||
#ifdef DUMPLOG
|
||||
|
||||
+21
-9
@@ -203,7 +203,7 @@ vomiting_dialogue()
|
||||
countdown, and it was still possible to move around between
|
||||
that message and "You can move again." (from vomit()'s
|
||||
nomul(-2)) with no intervening message; give one here to
|
||||
have a more specific at which hero became unable to move
|
||||
have more specific point at which hero became unable to move
|
||||
[vomit() issues its own message for the cantvomit() case] */
|
||||
You("%s!", !Hallucination ? "vomit" : "hurl chunks");
|
||||
}
|
||||
@@ -966,7 +966,7 @@ anything *arg;
|
||||
long timeout;
|
||||
{
|
||||
struct obj *obj = arg->a_obj;
|
||||
boolean canseeit, many, menorah, need_newsym;
|
||||
boolean canseeit, many, menorah, need_newsym, need_invupdate;
|
||||
xchar x, y;
|
||||
char whose[BUFSZ];
|
||||
|
||||
@@ -983,6 +983,7 @@ long timeout;
|
||||
|
||||
if (menorah) {
|
||||
obj->spe = 0; /* no more candles */
|
||||
obj->owt = weight(obj);
|
||||
} else if (Is_candle(obj) || obj->otyp == POT_OIL) {
|
||||
/* get rid of candles and burning oil potions;
|
||||
we know this object isn't carried by hero,
|
||||
@@ -1007,7 +1008,7 @@ long timeout;
|
||||
} else {
|
||||
canseeit = FALSE;
|
||||
}
|
||||
need_newsym = FALSE;
|
||||
need_newsym = need_invupdate = FALSE;
|
||||
|
||||
/* obj->age is the age remaining at this point. */
|
||||
switch (obj->otyp) {
|
||||
@@ -1016,6 +1017,8 @@ long timeout;
|
||||
if (canseeit) {
|
||||
switch (obj->where) {
|
||||
case OBJ_INVENT:
|
||||
need_invupdate = TRUE;
|
||||
/*FALLTHRU*/
|
||||
case OBJ_MINVENT:
|
||||
pline("%spotion of oil has burnt away.", whose);
|
||||
break;
|
||||
@@ -1077,6 +1080,8 @@ long timeout;
|
||||
if (canseeit || obj->where == OBJ_INVENT) {
|
||||
switch (obj->where) {
|
||||
case OBJ_INVENT:
|
||||
need_invupdate = TRUE;
|
||||
/*FALLTHRU*/
|
||||
case OBJ_MINVENT:
|
||||
if (obj->otyp == BRASS_LANTERN)
|
||||
pline("%slantern has run out of power.", whose);
|
||||
@@ -1154,6 +1159,8 @@ long timeout;
|
||||
if (menorah) {
|
||||
switch (obj->where) {
|
||||
case OBJ_INVENT:
|
||||
need_invupdate = TRUE;
|
||||
/*FALLTHRU*/
|
||||
case OBJ_MINVENT:
|
||||
pline("%scandelabrum's flame%s.", whose,
|
||||
many ? "s die" : " dies");
|
||||
@@ -1166,15 +1173,18 @@ long timeout;
|
||||
} else {
|
||||
switch (obj->where) {
|
||||
case OBJ_INVENT:
|
||||
/* no need_invupdate for update_inventory() necessary;
|
||||
useupall() -> freeinv() handles it */
|
||||
/*FALLTHRU*/
|
||||
case OBJ_MINVENT:
|
||||
pline("%s %s consumed!", Yname2(obj),
|
||||
many ? "are" : "is");
|
||||
break;
|
||||
case OBJ_FLOOR:
|
||||
/*
|
||||
You see some wax candles consumed!
|
||||
You see a wax candle consumed!
|
||||
*/
|
||||
You see some wax candles consumed!
|
||||
You see a wax candle consumed!
|
||||
*/
|
||||
You_see("%s%s consumed!", many ? "some " : "",
|
||||
many ? xname(obj) : an(xname(obj)));
|
||||
need_newsym = TRUE;
|
||||
@@ -1192,6 +1202,7 @@ long timeout;
|
||||
|
||||
if (menorah) {
|
||||
obj->spe = 0;
|
||||
obj->owt = weight(obj);
|
||||
} else {
|
||||
if (carried(obj)) {
|
||||
useupall(obj);
|
||||
@@ -1205,7 +1216,7 @@ long timeout;
|
||||
}
|
||||
obj = (struct obj *) 0;
|
||||
}
|
||||
break;
|
||||
break; /* case [age ==] 0 */
|
||||
|
||||
default:
|
||||
/*
|
||||
@@ -1218,8 +1229,7 @@ long timeout;
|
||||
|
||||
if (obj && obj->age)
|
||||
begin_burn(obj, TRUE);
|
||||
|
||||
break;
|
||||
break; /* case [otyp ==] candelabrum|tallow_candle|wax_candle */
|
||||
|
||||
default:
|
||||
impossible("burn_object: unexpeced obj %s", xname(obj));
|
||||
@@ -1227,6 +1237,8 @@ long timeout;
|
||||
}
|
||||
if (need_newsym)
|
||||
newsym(x, y);
|
||||
if (need_invupdate)
|
||||
update_inventory();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+14
-11
@@ -844,7 +844,7 @@ register struct trap *trap;
|
||||
unsigned trflags;
|
||||
{
|
||||
register int ttype = trap->ttyp;
|
||||
register struct obj *otmp;
|
||||
struct obj *otmp;
|
||||
boolean already_seen = trap->tseen,
|
||||
forcetrap = (trflags & FORCETRAP) != 0,
|
||||
webmsgok = (trflags & NOWEBMSG) == 0,
|
||||
@@ -915,8 +915,9 @@ unsigned trflags;
|
||||
otmp->opoisoned = 0;
|
||||
if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) { /* nothing */
|
||||
;
|
||||
} else if (thitu(8, dmgval(otmp, &youmonst), otmp, "arrow")) {
|
||||
obfree(otmp, (struct obj *) 0);
|
||||
} else if (thitu(8, dmgval(otmp, &youmonst), &otmp, "arrow")) {
|
||||
if (otmp)
|
||||
obfree(otmp, (struct obj *) 0);
|
||||
} else {
|
||||
place_object(otmp, u.ux, u.uy);
|
||||
if (!Blind)
|
||||
@@ -944,13 +945,15 @@ unsigned trflags;
|
||||
oldumort = u.umortality;
|
||||
if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) { /* nothing */
|
||||
;
|
||||
} else if (thitu(7, dmgval(otmp, &youmonst), otmp, "little dart")) {
|
||||
if (otmp->opoisoned)
|
||||
poisoned("dart", A_CON, "little dart",
|
||||
/* if damage triggered life-saving,
|
||||
poison is limited to attrib loss */
|
||||
(u.umortality > oldumort) ? 0 : 10, TRUE);
|
||||
obfree(otmp, (struct obj *) 0);
|
||||
} else if (thitu(7, dmgval(otmp, &youmonst), &otmp, "little dart")) {
|
||||
if (otmp) {
|
||||
if (otmp->opoisoned)
|
||||
poisoned("dart", A_CON, "little dart",
|
||||
/* if damage triggered life-saving,
|
||||
poison is limited to attrib loss */
|
||||
(u.umortality > oldumort) ? 0 : 10, TRUE);
|
||||
obfree(otmp, (struct obj *) 0);
|
||||
}
|
||||
} else {
|
||||
place_object(otmp, u.ux, u.uy);
|
||||
if (!Blind)
|
||||
@@ -1802,7 +1805,7 @@ int style;
|
||||
if (multi)
|
||||
nomul(0);
|
||||
if (thitu(9 + singleobj->spe, dmgval(singleobj, &youmonst),
|
||||
singleobj, (char *) 0))
|
||||
&singleobj, (char *) 0))
|
||||
stop_occupation();
|
||||
}
|
||||
if (style == ROLL) {
|
||||
|
||||
+28
-17
@@ -5,11 +5,12 @@
|
||||
#include "hack.h"
|
||||
|
||||
STATIC_DCL boolean FDECL(known_hitum, (struct monst *, struct obj *, int *,
|
||||
int, int, struct attack *));
|
||||
int, int, struct attack *, int));
|
||||
STATIC_DCL boolean FDECL(theft_petrifies, (struct obj *));
|
||||
STATIC_DCL void FDECL(steal_it, (struct monst *, struct attack *));
|
||||
STATIC_DCL boolean FDECL(hitum, (struct monst *, struct attack *));
|
||||
STATIC_DCL boolean FDECL(hmon_hitmon, (struct monst *, struct obj *, int));
|
||||
STATIC_DCL boolean FDECL(hmon_hitmon, (struct monst *, struct obj *, int,
|
||||
int));
|
||||
STATIC_DCL int FDECL(joust, (struct monst *, struct obj *));
|
||||
STATIC_DCL void NDECL(demonpet);
|
||||
STATIC_DCL boolean FDECL(m_slips_free, (struct monst * mtmp,
|
||||
@@ -23,8 +24,7 @@ STATIC_DCL void FDECL(nohandglow, (struct monst *));
|
||||
STATIC_DCL boolean FDECL(shade_aware, (struct obj *));
|
||||
|
||||
extern boolean notonhead; /* for long worms */
|
||||
/* The below might become a parameter instead if we use it a lot */
|
||||
static int dieroll;
|
||||
|
||||
/* Used to flag attacks caused by Stormbringer's maliciousness. */
|
||||
static boolean override_confirmation = FALSE;
|
||||
|
||||
@@ -434,12 +434,13 @@ atk_done:
|
||||
|
||||
/* really hit target monster; returns TRUE if it still lives */
|
||||
STATIC_OVL boolean
|
||||
known_hitum(mon, weapon, mhit, rollneeded, armorpenalty, uattk)
|
||||
known_hitum(mon, weapon, mhit, rollneeded, armorpenalty, uattk, dieroll)
|
||||
register struct monst *mon;
|
||||
struct obj *weapon;
|
||||
int *mhit;
|
||||
int rollneeded, armorpenalty; /* for monks */
|
||||
struct attack *uattk;
|
||||
int dieroll;
|
||||
{
|
||||
register boolean malive = TRUE;
|
||||
|
||||
@@ -463,7 +464,7 @@ struct attack *uattk;
|
||||
/* we hit the monster; be careful: it might die or
|
||||
be knocked into a different location */
|
||||
notonhead = (mon->mx != x || mon->my != y);
|
||||
malive = hmon(mon, weapon, HMON_MELEE);
|
||||
malive = hmon(mon, weapon, HMON_MELEE, dieroll);
|
||||
if (malive) {
|
||||
/* monster still alive */
|
||||
if (!rn2(25) && mon->mhp < mon->mhpmax / 2
|
||||
@@ -499,19 +500,22 @@ struct attack *uattk;
|
||||
int armorpenalty, attknum = 0, x = u.ux + u.dx, y = u.uy + u.dy,
|
||||
tmp = find_roll_to_hit(mon, uattk->aatyp, uwep,
|
||||
&attknum, &armorpenalty);
|
||||
int mhit = (tmp > (dieroll = rnd(20)) || u.uswallow);
|
||||
int dieroll = rnd(20);
|
||||
int mhit = (tmp > dieroll || u.uswallow);
|
||||
|
||||
if (tmp > dieroll)
|
||||
exercise(A_DEX, TRUE);
|
||||
malive = known_hitum(mon, uwep, &mhit, tmp, armorpenalty, uattk);
|
||||
malive = known_hitum(mon, uwep, &mhit, tmp, armorpenalty, uattk, dieroll);
|
||||
/* second attack for two-weapon combat; won't occur if Stormbringer
|
||||
overrode confirmation (assumes Stormbringer is primary weapon)
|
||||
or if the monster was killed or knocked to different location */
|
||||
if (u.twoweap && !override_confirmation && malive && m_at(x, y) == mon) {
|
||||
tmp = find_roll_to_hit(mon, uattk->aatyp, uswapwep, &attknum,
|
||||
&armorpenalty);
|
||||
mhit = (tmp > (dieroll = rnd(20)) || u.uswallow);
|
||||
malive = known_hitum(mon, uswapwep, &mhit, tmp, armorpenalty, uattk);
|
||||
dieroll = rnd(20);
|
||||
mhit = (tmp > dieroll || u.uswallow);
|
||||
malive = known_hitum(mon, uswapwep, &mhit, tmp, armorpenalty, uattk,
|
||||
dieroll);
|
||||
}
|
||||
if (wepbefore && !uwep)
|
||||
wep_was_destroyed = TRUE;
|
||||
@@ -521,16 +525,17 @@ struct attack *uattk;
|
||||
|
||||
/* general "damage monster" routine; return True if mon still alive */
|
||||
boolean
|
||||
hmon(mon, obj, thrown)
|
||||
hmon(mon, obj, thrown, dieroll)
|
||||
struct monst *mon;
|
||||
struct obj *obj;
|
||||
int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
|
||||
int dieroll;
|
||||
{
|
||||
boolean result, anger_guards;
|
||||
|
||||
anger_guards = (mon->mpeaceful
|
||||
&& (mon->ispriest || mon->isshk || is_watch(mon->data)));
|
||||
result = hmon_hitmon(mon, obj, thrown);
|
||||
result = hmon_hitmon(mon, obj, thrown, dieroll);
|
||||
if (mon->ispriest && !rn2(2))
|
||||
ghod_hitsu(mon);
|
||||
if (anger_guards)
|
||||
@@ -540,10 +545,11 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
|
||||
|
||||
/* guts of hmon() */
|
||||
STATIC_OVL boolean
|
||||
hmon_hitmon(mon, obj, thrown)
|
||||
hmon_hitmon(mon, obj, thrown, dieroll)
|
||||
struct monst *mon;
|
||||
struct obj *obj;
|
||||
int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
|
||||
int dieroll;
|
||||
{
|
||||
int tmp;
|
||||
struct permonst *mdat = mon->data;
|
||||
@@ -731,7 +737,8 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
|
||||
else
|
||||
setuwep((struct obj *) 0);
|
||||
freeinv(obj);
|
||||
potionhit(mon, obj, TRUE);
|
||||
potionhit(mon, obj,
|
||||
hand_to_hand ? POTHIT_HERO_BASH : POTHIT_HERO_THROW);
|
||||
if (mon->mhp <= 0)
|
||||
return FALSE; /* killed */
|
||||
hittxt = TRUE;
|
||||
@@ -2114,6 +2121,7 @@ register struct monst *mon;
|
||||
struct obj *weapon;
|
||||
boolean altwep = FALSE, weapon_used = FALSE;
|
||||
int i, tmp, armorpenalty, sum[NATTK], nsum = 0, dhit = 0, attknum = 0;
|
||||
int dieroll;
|
||||
|
||||
for (i = 0; i < NATTK; i++) {
|
||||
sum[i] = 0;
|
||||
@@ -2137,9 +2145,11 @@ register struct monst *mon;
|
||||
altwep = !altwep; /* toggle for next attack */
|
||||
tmp = find_roll_to_hit(mon, AT_WEAP, weapon, &attknum,
|
||||
&armorpenalty);
|
||||
dhit = (tmp > (dieroll = rnd(20)) || u.uswallow);
|
||||
dieroll = rnd(20);
|
||||
dhit = (tmp > dieroll || u.uswallow);
|
||||
/* Enemy dead, before any special abilities used */
|
||||
if (!known_hitum(mon, weapon, &dhit, tmp, armorpenalty, mattk)) {
|
||||
if (!known_hitum(mon, weapon, &dhit, tmp, armorpenalty, mattk,
|
||||
dieroll)) {
|
||||
sum[i] = 2;
|
||||
break;
|
||||
} else
|
||||
@@ -2168,7 +2178,8 @@ register struct monst *mon;
|
||||
case AT_TENT:
|
||||
tmp = find_roll_to_hit(mon, mattk->aatyp, (struct obj *) 0,
|
||||
&attknum, &armorpenalty);
|
||||
dhit = (tmp > (dieroll = rnd(20)) || u.uswallow);
|
||||
dieroll = rnd(20);
|
||||
dhit = (tmp > dieroll || u.uswallow);
|
||||
if (dhit) {
|
||||
int compat;
|
||||
|
||||
|
||||
+16
-29
@@ -474,9 +474,7 @@ static short FDECL(hup_set_font_name, (winid, char *));
|
||||
#endif
|
||||
static char *NDECL(hup_get_color_string);
|
||||
#endif /* CHANGE_COLOR */
|
||||
#ifdef STATUS_VIA_WINDOWPORT
|
||||
static void FDECL(hup_status_update, (int, genericptr_t, int, int));
|
||||
#endif
|
||||
static void FDECL(hup_status_update, (int, genericptr_t, int, int, int, unsigned long *));
|
||||
|
||||
static int NDECL(hup_int_ndecl);
|
||||
static void NDECL(hup_void_ndecl);
|
||||
@@ -526,14 +524,9 @@ static struct window_procs hup_procs = {
|
||||
hup_void_ndecl, /* end_screen */
|
||||
hup_outrip, genl_preference_update, genl_getmsghistory,
|
||||
genl_putmsghistory,
|
||||
#ifdef STATUS_VIA_WINDOWPORT
|
||||
hup_void_ndecl, /* status_init */
|
||||
hup_void_ndecl, /* status_finish */
|
||||
genl_status_enablefield, hup_status_update,
|
||||
#ifdef STATUS_HILITES
|
||||
genl_status_threshold,
|
||||
#endif
|
||||
#endif /* STATUS_VIA_WINDOWPORT */
|
||||
genl_can_suspend_no,
|
||||
};
|
||||
|
||||
@@ -762,17 +755,17 @@ hup_get_color_string(VOID_ARGS)
|
||||
}
|
||||
#endif /* CHANGE_COLOR */
|
||||
|
||||
#ifdef STATUS_VIA_WINDOWPORT
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
hup_status_update(idx, ptr, chg, percent)
|
||||
hup_status_update(idx, ptr, chg, pc, color, colormasks)
|
||||
int idx UNUSED;
|
||||
genericptr_t ptr UNUSED;
|
||||
int chg UNUSED, percent UNUSED;
|
||||
int chg UNUSED, pc UNUSED, color UNUSED;
|
||||
unsigned long *colormasks UNUSED;
|
||||
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif /* STATUS_VIA_WINDOWPORT */
|
||||
|
||||
/*
|
||||
* Non-specific stubs.
|
||||
@@ -816,7 +809,6 @@ const char *string UNUSED;
|
||||
|
||||
#endif /* HANGUPHANDLING */
|
||||
|
||||
#ifdef STATUS_VIA_WINDOWPORT
|
||||
|
||||
/****************************************************************************/
|
||||
/* genl backward compat stuff */
|
||||
@@ -871,10 +863,11 @@ boolean enable;
|
||||
|
||||
/* call once for each field, then call with BL_FLUSH to output the result */
|
||||
void
|
||||
genl_status_update(idx, ptr, chg, percent)
|
||||
genl_status_update(idx, ptr, chg, percent, color, colormasks)
|
||||
int idx;
|
||||
genericptr_t ptr;
|
||||
int chg UNUSED, percent UNUSED;
|
||||
int chg UNUSED, percent UNUSED, color UNUSED;
|
||||
unsigned long *colormasks UNUSED;
|
||||
{
|
||||
char newbot1[MAXCO], newbot2[MAXCO];
|
||||
long cond, *condptr = (long *) ptr;
|
||||
@@ -912,12 +905,17 @@ int chg UNUSED, percent UNUSED;
|
||||
BL_LEVELDESC, BL_GOLD, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_FLUSH },
|
||||
};
|
||||
|
||||
/* in case interface is using genl_status_update() but has not
|
||||
specified WC2_FLUSH_STATUS (status_update() for field values
|
||||
is buffered so final BL_FLUSH is needed to produce output) */
|
||||
windowprocs.wincap2 |= WC2_FLUSH_STATUS;
|
||||
|
||||
if (idx != BL_FLUSH) {
|
||||
if (!status_activefields[idx])
|
||||
return;
|
||||
switch (idx) {
|
||||
case BL_CONDITION:
|
||||
cond = *condptr;
|
||||
cond = condptr ? *condptr : 0L;
|
||||
nb = status_vals[idx];
|
||||
*nb = '\0';
|
||||
if (cond & BL_MASK_STONE)
|
||||
@@ -949,7 +947,8 @@ int chg UNUSED, percent UNUSED;
|
||||
break;
|
||||
default:
|
||||
Sprintf(status_vals[idx],
|
||||
status_fieldfmt[idx] ? status_fieldfmt[idx] : "%s", text);
|
||||
status_fieldfmt[idx] ? status_fieldfmt[idx] : "%s",
|
||||
text ? text : "");
|
||||
break;
|
||||
}
|
||||
return; /* processed one field other than BL_FLUSH */
|
||||
@@ -1035,18 +1034,6 @@ int chg UNUSED, percent UNUSED;
|
||||
putmixed(WIN_STATUS, 0, newbot2); /* putmixed() due to GOLD glyph */
|
||||
}
|
||||
|
||||
#ifdef STATUS_HILITES
|
||||
void
|
||||
genl_status_threshold(fldidx, thresholdtype, threshold, behavior, under, over)
|
||||
int fldidx UNUSED, thresholdtype UNUSED;
|
||||
anything threshold UNUSED;
|
||||
int behavior UNUSED, under UNUSED, over UNUSED;
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif /* STATUS_HILITES */
|
||||
#endif /* STATUS_VIA_WINDOWPORT */
|
||||
|
||||
STATIC_VAR struct window_procs dumplog_windowprocs_backup;
|
||||
STATIC_VAR FILE *dumplog_file;
|
||||
|
||||
|
||||
@@ -3429,7 +3429,7 @@ int dx, dy;
|
||||
if (bhitpos.x == u.ux && bhitpos.y == u.uy) { /* ct == 9 */
|
||||
if (Fumbling || rn2(20) >= ACURR(A_DEX)) {
|
||||
/* we hit ourselves */
|
||||
(void) thitu(10 + obj->spe, dmgval(obj, &youmonst), obj,
|
||||
(void) thitu(10 + obj->spe, dmgval(obj, &youmonst), &obj,
|
||||
"boomerang");
|
||||
endmultishot(TRUE);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user