uhandedness follow-up

boomerang trajectory
bones
This commit is contained in:
nhmall
2023-12-02 20:25:37 -05:00
parent fe2d8faed9
commit 7d22a2c7b9
5 changed files with 48 additions and 3 deletions

View File

@@ -174,6 +174,7 @@ extern boolean can_make_bones(void);
extern void savebones(int, time_t, struct obj *);
extern int getbones(void);
extern boolean bones_include_name(const char *);
extern void fix_ghostly_obj(struct obj *);
/* ### botl.c ### */

View File

@@ -137,15 +137,16 @@ struct obj {
* and for horn of plenty (when tipping) even though
* they have no locks */
Bitfield(pickup_prev, 1); /* was picked up previously */
Bitfield(ghostly, 1); /* it just got placed into a bones file */
#if 0
/* not implemented */
Bitfield(tknown, 1); /* trap status known for chests */
Bitfield(eknown, 1); /* effect known for wands zapped or rings worn when
* not seen yet after being picked up while blind
* [maybe for remaining stack of used potion too] */
/* 1 free bit */
/* 0 free bits */
#else
/* 3 free bits */
/* 2 free bits */
#endif
int corpsenm; /* type of corpse is mons[corpsenm] */

View File

@@ -11,6 +11,7 @@ static void resetobjs(struct obj *, boolean);
static void give_to_nearby_mon(struct obj *, coordxy, coordxy);
static boolean fixuporacle(struct monst *);
static void remove_mon_from_bones(struct monst *);
static void set_ghostly_objlist(struct obj *objchain);
static boolean
no_bones_level(d_level *lev)
@@ -448,6 +449,7 @@ savebones(int how, time_t when, struct obj *corpse)
for (f = gf.ffruit; f; f = f->nextf)
f->fid = -f->fid;
set_ghostly_objlist(gi.invent);
/* dispose of your possessions, usually cursed */
if (u.ugrave_arise == (NON_PM - 1)) {
struct obj *otmp;
@@ -503,6 +505,7 @@ savebones(int how, time_t when, struct obj *corpse)
mtmp->msleeping = 1;
}
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
set_ghostly_objlist(mtmp->minvent);
resetobjs(mtmp->minvent, FALSE);
/* do not zero out m_ids for bones levels any more */
mtmp->mlstmv = 0L;
@@ -515,7 +518,9 @@ savebones(int how, time_t when, struct obj *corpse)
ttmp->madeby_u = 0;
ttmp->tseen = unhideable_trap(ttmp->ttyp);
}
set_ghostly_objlist(fobj);
resetobjs(fobj, FALSE);
set_ghostly_objlist(gl.level.buriedobjlist);
resetobjs(gl.level.buriedobjlist, FALSE);
/* Hero is no longer on the map. */
@@ -722,4 +727,39 @@ bones_include_name(const char *name)
return FALSE;
}
/* set the ghostly bit in a list of objects */
static void
set_ghostly_objlist(struct obj *objchain)
{
while (objchain) {
objchain->ghostly = 1;
objchain = objchain->nobj;
}
}
/* This is called when a marked object from a bones file is picked-up.
Some could result in a message, and the obj->ghostly flag is always
cleared. obj->ghostly has no other usage at this time. */
void
fix_ghostly_obj(struct obj *obj)
{
if (!obj->ghostly)
return;
switch(obj->otyp) {
/* asymetrical weapons */
case BOW:
case ELVEN_BOW:
case ORCISH_BOW:
case YUMI:
case BOOMERANG:
You("make adjustments to %s to suit your %s hand.",
the(xname(obj)),
URIGHTY ? "right" : "left");
break;
default:
break;
}
obj->ghostly = 0;
}
/*bones.c*/

View File

@@ -1790,6 +1790,8 @@ pickup_object(
if (uwep && uwep == obj)
gm.mrg_to_wielded = TRUE;
pickup_prinv(obj, count, "lifting");
if (obj->ghostly)
fix_ghostly_obj(obj);
gm.mrg_to_wielded = FALSE;
return 1;
}

View File

@@ -4011,7 +4011,8 @@ boomhit(struct obj *obj, coordxy dx, coordxy dy)
register int i, ct;
int boom; /* showsym[] index */
struct monst *mtmp;
boolean counterclockwise = TRUE; /* right-handed throw */
boolean counterclockwise = URIGHTY; /* URIGHTY = right-handed throw
else ULEFTY = left-handed throw */
/* counterclockwise traversal patterns:
* ..........................54.................................